@masknet/eslint-plugin
Version:
eslint plugin for masknet
390 lines (389 loc) • 21.4 kB
JSON
{
"$schema": "http://json-schema.org/draft-04/schema",
"allOf": [{ "$ref": "https://json.schemastore.org/eslintrc.json" }],
"properties": {
"rules": { "$ref": "#/definitions/user-defined-rules" },
"plugins": {
"type": "array",
"items": { "anyOf": [{ "type": "string" }] },
"uniqueItems": true
},
"extends": {
"oneOf": [
{ "$ref": "#/definitions/preset-configs" },
{
"type": "array",
"items": { "$ref": "#/definitions/preset-configs" },
"uniqueItems": true
}
]
},
"overrides": {
"type": "array",
"items": {
"type": "object",
"properties": {
"rules": { "$ref": "#/definitions/user-defined-rules" }
}
}
}
},
"definitions": {
"rule": { "type": "string", "enum": ["off", "warn", "error"] },
"preset-configs": {
"anyOf": [
{ "type": "string" },
{
"type": "string",
"enum": [
"plugin:@masknet/all",
"plugin:@masknet/base",
"plugin:@masknet/fixable",
"plugin:@masknet/recommended",
"plugin:@masknet/recommended-requires-type-checking"
]
}
]
},
"user-defined-rules": {
"type": "object",
"properties": {
"@masknet/array/no-unneeded-flat-map": {
"description": "Disallow `Array#flatMap((x) => x)` when simpler alternatives exist\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/array/no-unneeded-flat-map",
"$ref": "#/definitions/rule"
},
"@masknet/array/prefer-from": {
"description": "Prefer `Array.from(...)` over `new Array(...)`\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/array/prefer-from",
"$ref": "#/definitions/rule"
},
"@masknet/browser/no-persistent-storage": {
"description": "Disallow use browser persistent storage\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/browser/no-persistent-storage",
"$ref": "#/definitions/rule"
},
"@masknet/browser/no-set-html": {
"description": "Disallow use `Element#{inner,outer}HTML`\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/browser/no-set-html",
"$ref": "#/definitions/rule"
},
"@masknet/browser/prefer-location-assign": {
"description": "Prefer `location.assign(...)` over `location.*`\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/browser/prefer-location-assign",
"$ref": "#/definitions/rule"
},
"@masknet/jsx/no-class-component": {
"description": "Disallow React Class Component\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/jsx/no-class-component",
"$ref": "#/definitions/rule"
},
"@masknet/jsx/no-logical": {
"description": "Limit the complexity of JSX logic expression\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/jsx/no-logical",
"oneOf": [
{ "$ref": "#/definitions/rule" },
{
"type": "array",
"items": [
{ "$ref": "#/definitions/rule" },
{
"oneOf": [
{ "type": "integer", "minimum": 0 },
{
"type": "object",
"properties": {
"attribute": { "type": "integer", "minimum": 0 },
"element": { "type": "integer", "minimum": 0 }
},
"additionalProperties": false
}
]
}
],
"minItems": 2
}
]
},
"@masknet/jsx/no-set-html": {
"description": "Disallow use `dangerouslySetInnerHTML` jsx attribute\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/jsx/no-set-html",
"$ref": "#/definitions/rule"
},
"@masknet/jsx/no-template-literal": {
"description": "Disallow use template-literal in JSX\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/jsx/no-template-literal",
"$ref": "#/definitions/rule"
},
"@masknet/jsx/no-unneeded-nested": {
"description": "Reduce unneeded JSXFragment nested\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/jsx/no-unneeded-nested",
"$ref": "#/definitions/rule"
},
"@masknet/jsx/prefer-test-id": {
"description": "Enforces `data-test-id` attribute is present on interactive DOM elements to help with UI testing\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/jsx/prefer-test-id",
"oneOf": [
{ "$ref": "#/definitions/rule" },
{
"type": "array",
"items": [
{ "$ref": "#/definitions/rule" },
{
"type": "object",
"properties": {
"id": { "type": "string" },
"elements": {
"type": "array",
"items": { "type": "string" },
"uniqueItems": true
},
"attributes": {
"type": "array",
"items": { "type": "string" },
"uniqueItems": true
},
"ignore-attributes": {
"type": "array",
"items": { "type": "string" },
"uniqueItems": true
}
},
"additionalProperties": false
}
],
"minItems": 2
}
]
},
"@masknet/string/no-data-url": {
"description": "Disallow use Data URL\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/string/no-data-url",
"$ref": "#/definitions/rule"
},
"@masknet/string/no-interpolation": {
"description": "Disallow simple string interpolation\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/string/no-interpolation",
"$ref": "#/definitions/rule"
},
"@masknet/string/no-locale-case": {
"description": "Disallow use `String#toLocale{Upper,Lower}Case()`\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/string/no-locale-case",
"$ref": "#/definitions/rule"
},
"@masknet/string/no-simple-template-literal": {
"description": "Disallow simple template-literal\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/string/no-simple-template-literal",
"$ref": "#/definitions/rule"
},
"@masknet/string/no-unneeded-to-string": {
"description": "Disallow `String#toString()` when simpler alternatives exist\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/string/no-unneeded-to-string",
"$ref": "#/definitions/rule"
},
"@masknet/type/no-const-enum": {
"description": "Disallow use constants enumerate\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/type/no-const-enum",
"$ref": "#/definitions/rule"
},
"@masknet/type/no-empty-literal": {
"description": "Disallow empty {array,object} literal\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/type/no-empty-literal",
"oneOf": [
{ "$ref": "#/definitions/rule" },
{
"type": "array",
"items": [
{ "$ref": "#/definitions/rule" },
{
"type": "object",
"properties": {
"array": { "type": "string" },
"object": { "type": "string" }
},
"additionalProperties": false
}
],
"minItems": 2
}
]
},
"@masknet/type/no-force-cast-via-top-type": {
"description": "Disallowing cast a type `T` to unrelated or incompatible type `Q` via `T as any as Q`\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/type/no-force-cast-via-top-type",
"$ref": "#/definitions/rule"
},
"@masknet/type/no-instanceof-wrapper": {
"description": "Disallow `instanceof` for wrapper objects\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/type/no-instanceof-wrapper",
"$ref": "#/definitions/rule"
},
"@masknet/type/no-number-constructor": {
"description": "Disallow use `Number` constructor\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/type/no-number-constructor",
"$ref": "#/definitions/rule"
},
"@masknet/type/no-wrapper-type-reference": {
"description": "Disallow wrapper type for type reference\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/type/no-wrapper-type-reference",
"$ref": "#/definitions/rule"
},
"@masknet/type/prefer-return-type-annotation": {
"description": "Enforce Move return type annotation to function return type\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/type/prefer-return-type-annotation",
"$ref": "#/definitions/rule"
},
"@masknet/unicode/no-bidi": {
"description": "Detect and stop Trojan Source attacks\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/unicode/no-bidi",
"$ref": "#/definitions/rule"
},
"@masknet/unicode/no-invisible": {
"description": "Disallow invisible characters\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/unicode/no-invisible",
"$ref": "#/definitions/rule"
},
"@masknet/unicode/specific-set": {
"description": "Limit the range of literal characters\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/unicode/specific-set",
"oneOf": [
{ "$ref": "#/definitions/rule" },
{
"type": "array",
"items": [
{ "$ref": "#/definitions/rule" },
{
"type": "object",
"properties": {
"pattern": { "type": "string" },
"flags": { "type": "string" },
"only": { "type": "string", "enum": ["code", "comment"] }
},
"additionalProperties": false
}
],
"minItems": 2
}
]
},
"@masknet/no-builtin-base64": {
"description": "Disallow use built-in base64 function\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/no-builtin-base64",
"$ref": "#/definitions/rule"
},
"@masknet/no-default-error": {
"description": "Restrict the usage of default (unextended) error\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/no-default-error",
"$ref": "#/definitions/rule"
},
"@masknet/no-for-in": {
"description": "Disallow use for-in\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/no-for-in",
"$ref": "#/definitions/rule"
},
"@masknet/no-redundant-variable": {
"description": "Disallow redundant variable\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/no-redundant-variable",
"$ref": "#/definitions/rule"
},
"@masknet/no-single-return": {
"description": "Disallow single-return\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/no-single-return",
"$ref": "#/definitions/rule"
},
"@masknet/no-then": {
"description": "Disallow `Promise#then(...)`\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/no-then",
"$ref": "#/definitions/rule"
},
"@masknet/no-timer": {
"description": "Disallow use timer function\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/no-timer",
"$ref": "#/definitions/rule"
},
"@masknet/no-top-level": {
"description": "Disallow side-effect at module top-level\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/no-top-level",
"oneOf": [
{ "$ref": "#/definitions/rule" },
{
"type": "array",
"items": [
{ "$ref": "#/definitions/rule" },
{
"type": "object",
"properties": {
"variable": { "type": "boolean" },
"side-effect": { "type": "boolean" }
},
"additionalProperties": false
}
],
"minItems": 2
}
]
},
"@masknet/no-unsafe-date": {
"description": "Disallow use unsafe Date methods\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/no-unsafe-date",
"$ref": "#/definitions/rule"
},
"@masknet/prefer-default-export": {
"description": "Enforce default export location at top or bottom\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/prefer-default-export",
"oneOf": [
{ "$ref": "#/definitions/rule" },
{
"type": "array",
"items": [
{ "$ref": "#/definitions/rule" },
{ "type": "string", "enum": ["at-top", "at-bottom"] }
],
"minItems": 2
}
]
},
"@masknet/prefer-defer-import": {
"description": "Prefer defer import a module. See <https://github.com/tc39/proposal-defer-import-eval> and <https://github.com/webpack/webpack/pull/16567/>.\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/prefer-defer-import",
"oneOf": [
{ "$ref": "#/definitions/rule" },
{
"type": "array",
"items": [
{ "$ref": "#/definitions/rule" },
{
"type": "object",
"oneOf": [
{
"type": "object",
"additionalProperties": false,
"properties": {
"deferPackages": {
"type": "array",
"items": { "type": "string" },
"minItems": 0
},
"syntax": {
"type": "string",
"enum": ["webpack-magic-comment"]
}
}
},
{
"type": "object",
"additionalProperties": false,
"properties": {
"eagerPackages": {
"type": "array",
"items": { "type": "string" },
"minItems": 0
},
"syntax": {
"type": "string",
"enum": ["webpack-magic-comment"]
}
}
}
]
}
],
"minItems": 2
}
]
},
"@masknet/prefer-early-return": {
"description": "Prefer early returns over full-body conditional wrapping in function declarations\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/prefer-early-return",
"oneOf": [
{ "$ref": "#/definitions/rule" },
{
"type": "array",
"items": [
{ "$ref": "#/definitions/rule" },
{
"type": "object",
"properties": {
"maximumStatements": { "type": "integer", "minimum": 0 }
},
"additionalProperties": false
}
],
"minItems": 2
}
]
},
"@masknet/prefer-fetch": {
"description": "Enforce fetch\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/prefer-fetch",
"$ref": "#/definitions/rule"
},
"@masknet/prefer-timer-id": {
"description": "Enforce best practice with timer function\nhttps://dimensiondev.github.io/eslint-plugin/src/rules/prefer-timer-id",
"$ref": "#/definitions/rule"
}
}
}
}
}