diff --git a/.eslintignore b/.eslintignore
index bc0faff..bd5b688 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1,2 +1,4 @@
/node_modules
-!.eslintrc.*
+!.eslintrc.js
+!.ncurc.js
+coverage
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml
index 1d61214..47d5dc0 100644
--- a/.github/workflows/CI.yml
+++ b/.github/workflows/CI.yml
@@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- node: [12.x, 10.x, 8.x]
+ node: [12.x, 10.x]
steps:
- name: Checkout
uses: actions/checkout@v1
diff --git a/.ncurc.js b/.ncurc.js
new file mode 100644
index 0000000..f47deb4
--- /dev/null
+++ b/.ncurc.js
@@ -0,0 +1,8 @@
+"use strict"
+
+module.exports = {
+ // Whitelist all for checking besides `peer` which indicates
+ // somewhat older versions of `eslint` we still support even
+ // while our devDeps point to a more recent version
+ dep: "prod,dev,optional,bundle",
+}
diff --git a/.nycrc.yml b/.nycrc.yml
index 5bf9a3c..272305b 100644
--- a/.nycrc.yml
+++ b/.nycrc.yml
@@ -1,7 +1,5 @@
include:
- lib
-exclude:
-- lib/processors/vue.js
reporter:
- text-summary
- lcov
diff --git a/README.md b/README.md
index 2d9263c..a42a4e3 100644
--- a/README.md
+++ b/README.md
@@ -1,17 +1,17 @@
-# @mysticatea/eslint-plugin
+# @mysticatea/eslint-plugin-core
-[](https://www.npmjs.com/package/@mysticatea/eslint-plugin)
-[](http://www.npmtrends.com/@mysticatea/eslint-plugin)
-[](https://github.com/mysticatea/eslint-plugin/actions)
-[](https://codecov.io/gh/mysticatea/eslint-plugin)
-[](https://david-dm.org/mysticatea/eslint-plugin)
+[](https://www.npmjs.com/package/@mysticatea/eslint-plugin-core)
+[](http://www.npmtrends.com/@mysticatea/eslint-plugin-core)
+[](https://github.com/mysticatea/eslint-plugin-core/actions)
+[](https://codecov.io/gh/mysticatea/eslint-plugin-core)
+[](https://david-dm.org/mysticatea/eslint-plugin-core)
-Additional ESLint rules and ESLint configurations for me.
+Additional ESLint rules and ESLint configurations.
## đż Installation
```
-npm install --save-dev eslint @mysticatea/eslint-plugin
+npm install --save-dev eslint @mysticatea/eslint-plugin-core
```
### Requirements
@@ -25,88 +25,10 @@ Write in your ESLint configurations: http://eslint.org/docs/user-guide/configuri
### Configs
-- `plugin:@mysticatea/es2020` ... Basic configuration for ES2020.
-- `plugin:@mysticatea/es2019` ... Basic configuration for ES2019.
-- `plugin:@mysticatea/es2018` ... Basic configuration for ES2018.
-- `plugin:@mysticatea/es2017` ... Basic configuration for ES2017.
-- `plugin:@mysticatea/es2016` ... Basic configuration for ES2016.
-- `plugin:@mysticatea/es2015` ... Basic configuration for ES2015.
-- `plugin:@mysticatea/es5` ... Basic configuration for ES5.
-- `plugin:@mysticatea/+modules` ... Additional configuration for ES modules.
-- `plugin:@mysticatea/+browser` ... Additional configuration for browser environment.
-- `plugin:@mysticatea/+node` ... Additional configuration for Node.js environment.
-- `plugin:@mysticatea/+eslint-plugin` ... Additional configuration for ESLint plugins. This includes `plugin:mysticatea/+node` setting.
-
-#### Details
-
-The main configurations `plugin:@mysticatea/es*` does:
-
-- detect bug-like code by ESLint rules.
-- enforce whitespace style by Prettier.
-- handle the `.ts` files as TypeScript then check by `typescript-eslint-parser` and `eslint-plugin-typescript`.
-- handle the `.vue` files as Vue.js SFC then check by `vue-eslint-parser` and `eslint-plugin-vue`.
-- handle the files in `test`/`tests` directory as `mocha`'s test code.
-- handle the files in `scripts` directory as Node.js environment.
-- handle the `.eslintrc.js` file as a Node.js script.
-- handle the `webpack.config.js` file as a Node.js script.
-- handle the `rollup.config.js` file as an ES module.
-
-You can use combination of a main configuration and some additional configurations.
-For examples:
-
-##### For Node.js
-
-```json
-{
- "extends": [
- "plugin:@mysticatea/es2015",
- "plugin:@mysticatea/+node"
- ]
-}
-```
-
-> It handles `.js` files as scripts and `.mjs` files as modules.
-
-##### For Browsers
-
-```json
-{
- "extends": [
- "plugin:@mysticatea/es2015",
- "plugin:@mysticatea/+browser"
- ]
-}
-```
-
-##### For Browsers with ES modules
-
-```json
-{
- "extends": [
- "plugin:@mysticatea/es2015",
- "plugin:@mysticatea/+modules",
- "plugin:@mysticatea/+browser"
- ]
-}
-```
-
-##### For ESLint plugins
-
-```json
-{
- "extends": [
- "plugin:@mysticatea/es2015",
- "plugin:@mysticatea/+eslint-plugin"
- ]
-}
-```
+- `plugin:@mysticatea/core/es5` ... Basic configuration for ES5.
### Rules
-This plugin has some original rules and foreign rules.
-
-#### Original rules
-
- [@mysticatea/arrow-parens](docs/rules/arrow-parens.md) enforces parens of argument lists (excludes too redundant parens) (fixable).
- [@mysticatea/block-scoped-var](docs/rules/block-scoped-var.md) handles variables which are declared by `var` declaration as block-scoped. It disallows redeclarations, uses from outside of the scope, shadowing.
- [@mysticatea/no-instanceof-array](docs/rules/no-instanceof-array.md) disallows 'instanceof' for Array (fixable).
@@ -117,25 +39,13 @@ This plugin has some original rules and foreign rules.
- [@mysticatea/no-useless-rest-spread](docs/rules/no-useless-rest-spread.md) disallows unnecessary rest/spread operators (fixable).
- [@mysticatea/prefer-for-of](docs/rules/prefer-for-of.md) requires `for-of` statements instead of `Array#forEach` or something like (fixable).
-#### Foreign rules
-
-- All `@mysticatea/eslint-comments/*` rules are imported from [eslint-plugin-eslint-comments](https://www.npmjs.com/package/eslint-plugin-eslint-comments).
-- All `@mysticatea/eslint-plugin/*` rules are imported from [eslint-plugin-eslint-plugin](https://www.npmjs.com/package/eslint-plugin-eslint-plugin).
-- All `@mysticatea/node/*` rules are imported from [eslint-plugin-node](https://www.npmjs.com/package/eslint-plugin-node).
-- All `@mysticatea/ts/*` rules are imported from [eslint-plugin-typescript](https://www.npmjs.com/package/eslint-plugin-typescript).
-- All `@mysticatea/vue/*` rules are imported from [eslint-plugin-vue](https://www.npmjs.com/package/eslint-plugin-vue).
-- The `@mysticatea/prettier` rule is imported from [eslint-plugin-prettier](https://www.npmjs.com/package/eslint-plugin-prettier).
-
-> **Q:** Why don't you use those plugins directly?
-> **A:** The combination with shareable configs and plugins has some problems because shareable configs were not designed to be used with plugins. @nzakas illustrated a way to use plugins as shareable configs together with other plugins in the discussion [eslint/eslint#3458](https://github.com/eslint/eslint/issues/3458#issuecomment-257161846). This is the way.
-
## đ„ Semantic Versioning Policy
This plugin follows [semantic versioning](http://semver.org/) and [ESLint's Semantic Versioning Policy](https://github.com/eslint/eslint#semantic-versioning-policy).
## đ° Changelog
-- [GitHub Releases](https://github.com/mysticatea/eslint-plugin/releases)
+- [GitHub Releases](https://github.com/mysticatea/eslint-plugin-core/releases)
## â€ïž Contributing
diff --git a/index.js b/index.js
index 4e4cfd8..843d9bf 100644
--- a/index.js
+++ b/index.js
@@ -6,7 +6,5 @@
module.exports = {
configs: require("./lib/configs"),
- processors: require("./lib/processors"),
rules: require("./lib/rules"),
- utils: require("./lib/utils"),
}
diff --git a/lib/configs.js b/lib/configs.js
index de02178..3b64e3b 100644
--- a/lib/configs.js
+++ b/lib/configs.js
@@ -4,15 +4,7 @@
"use strict"
module.exports = {
- "+browser": require("./configs/+browser"),
- "+eslint-plugin": require("./configs/+eslint-plugin"),
- "+modules": require("./configs/+modules"),
- "+node": require("./configs/+node"),
+ all: require("./configs/all"),
es2015: require("./configs/es2015"),
- es2016: require("./configs/es2016"),
- es2017: require("./configs/es2017"),
- es2018: require("./configs/es2018"),
- es2019: require("./configs/es2019"),
- es2020: require("./configs/es2020"),
es5: require("./configs/es5"),
}
diff --git a/lib/configs/+eslint-plugin.js b/lib/configs/+eslint-plugin.js
deleted file mode 100644
index 1241df1..0000000
--- a/lib/configs/+eslint-plugin.js
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * @author Toru Nagashima
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-const { rulesDocumentUrl } = require("../utils")
-
-module.exports = {
- extends: [require.resolve("./+node.js")],
- overrides: [
- {
- files: ["**/rules/**", "**/internal-rules/**"],
- rules: {
- // Enabled rules
- "@mysticatea/eslint-plugin/consistent-output": "error",
- "@mysticatea/eslint-plugin/fixer-return": "error",
- "@mysticatea/eslint-plugin/meta-property-ordering": [
- "error",
- [
- "deprecated",
- "docs",
- "fixable",
- "messages",
- "replacedBy",
- "schema",
- "type",
- ],
- ],
- "@mysticatea/eslint-plugin/no-deprecated-context-methods":
- "error",
- "@mysticatea/eslint-plugin/no-deprecated-report-api": "error",
- "@mysticatea/eslint-plugin/no-identical-tests": "error",
- "@mysticatea/eslint-plugin/no-missing-placeholders": "error",
- "@mysticatea/eslint-plugin/no-unused-placeholders": "error",
- "@mysticatea/eslint-plugin/no-useless-token-range": "error",
- "@mysticatea/eslint-plugin/prefer-output-null": "error",
- "@mysticatea/eslint-plugin/prefer-placeholders": "error",
- "@mysticatea/eslint-plugin/prefer-replace-text": "error",
- "@mysticatea/eslint-plugin/report-message-format": [
- "error",
- "[^a-z'\"{].*\\.$",
- ],
- "@mysticatea/eslint-plugin/require-meta-docs-url": [
- "error",
- { pattern: rulesDocumentUrl },
- ],
- "@mysticatea/eslint-plugin/require-meta-fixable": "error",
- "@mysticatea/eslint-plugin/require-meta-type": "error",
- "@mysticatea/eslint-plugin/test-case-property-ordering": [
- "error",
- [
- "filename",
- "code",
- "output",
- "options",
- "parser",
- "parserOptions",
- "globals",
- "env",
- "errors",
- ],
- ],
- "@mysticatea/eslint-plugin/test-case-shorthand-strings":
- "error",
- },
- },
- ],
-}
diff --git a/lib/configs/+modules.js b/lib/configs/+modules.js
deleted file mode 100644
index dcb084e..0000000
--- a/lib/configs/+modules.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * @author Toru Nagashima
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-module.exports = {
- parserOptions: {
- ecmaFeatures: { globalReturn: false },
- sourceType: "module",
- },
- globals: {
- __dirname: "off",
- __filename: "off",
- exports: "off",
- module: "off",
- require: "off",
- },
- rules: {
- "@mysticatea/node/no-extraneous-import": "error",
- "@mysticatea/node/file-extension-in-import": [
- "error",
- "always",
- { ".js": "never", ".ts": "never", ".tsx": "never" },
- ],
- "@mysticatea/node/no-missing-import": "error",
- "@mysticatea/node/no-unpublished-import": "error",
- "@mysticatea/node/no-unsupported-features/es-syntax": [
- "error",
- { ignores: ["modules", "dynamicImport"] },
- ],
- },
- overrides: [
- {
- files: ["*.ts", "*.tsx", "*.vue"],
- rules: {
- "@mysticatea/node/no-unsupported-features/es-syntax": "off",
- },
- },
- ],
-}
diff --git a/lib/configs/+node.js b/lib/configs/+node.js
deleted file mode 100644
index b151b63..0000000
--- a/lib/configs/+node.js
+++ /dev/null
@@ -1,100 +0,0 @@
-/**
- * @author Toru Nagashima
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-module.exports = {
- parserOptions: {
- ecmaFeatures: { globalReturn: true },
- ecmaVersion: 2020,
- sourceType: "script",
- },
- globals: {
- // ECMAScript (experimental)
- globalThis: "readonly",
- // ECMA-404
- Intl: "readonly",
-
- // Web Standard
- TextDecoder: "readonly",
- TextEncoder: "readonly",
- URL: "readonly",
- URLSearchParams: "readonly",
- WebAssembly: "readonly",
- clearInterval: "readonly",
- clearTimeout: "readonly",
- console: "readonly",
- queueMicrotask: "readonly",
- setInterval: "readonly",
- setTimeout: "readonly",
-
- // Node.js
- Buffer: "readonly",
- GLOBAL: "readonly",
- clearImmediate: "readonly",
- global: "readonly",
- process: "readonly",
- root: "readonly",
- setImmediate: "readonly",
-
- // CommonJS
- __dirname: "readonly",
- __filename: "readonly",
- exports: "writable",
- module: "readonly",
- require: "readonly",
- },
- rules: {
- "@mysticatea/node/exports-style": ["error", "module.exports"],
- "@mysticatea/node/file-extension-in-import": [
- "error",
- "always",
- { ".js": "never", ".ts": "never", ".tsx": "never" },
- ],
- "@mysticatea/node/no-callback-literal": "off",
- "@mysticatea/node/no-deprecated-api": "error",
- "@mysticatea/node/no-exports-assign": "error",
- "@mysticatea/node/no-extraneous-import": "error",
- "@mysticatea/node/no-extraneous-require": "error",
- "@mysticatea/node/no-missing-import": "error",
- "@mysticatea/node/no-missing-require": "error",
- "@mysticatea/node/no-unpublished-bin": "error",
- "@mysticatea/node/no-unpublished-import": "error",
- "@mysticatea/node/no-unpublished-require": "error",
- "@mysticatea/node/no-unsupported-features/es-builtins": "error",
- "@mysticatea/node/no-unsupported-features/es-syntax": "error",
- "@mysticatea/node/no-unsupported-features/node-builtins": "error",
- "@mysticatea/node/prefer-global/buffer": "error",
- "@mysticatea/node/prefer-global/console": "error",
- "@mysticatea/node/prefer-global/process": "error",
- "@mysticatea/node/prefer-global/text-decoder": "off",
- "@mysticatea/node/prefer-global/text-encoder": "off",
- "@mysticatea/node/prefer-global/url-search-params": "off",
- "@mysticatea/node/prefer-global/url": "off",
- "@mysticatea/node/prefer-promises/dns": "off",
- "@mysticatea/node/prefer-promises/fs": "off",
- "@mysticatea/node/process-exit-as-throw": "error",
- "@mysticatea/node/shebang": "error",
- },
- settings: {
- node: {
- tryExtensions: [
- ".vue",
- ".tsx",
- ".ts",
- ".mjs",
- ".cjs",
- ".js",
- ".json",
- ".node",
- ],
- },
- },
- overrides: [
- {
- files: ["*.mjs", "*.ts", "*.tsx", "*.vue"],
- extends: [require.resolve("./+modules.js")],
- },
- ],
-}
diff --git a/lib/configs/_base.js b/lib/configs/_base.js
index 4a21337..78b110a 100644
--- a/lib/configs/_base.js
+++ b/lib/configs/_base.js
@@ -7,401 +7,7 @@
module.exports = {
root: true,
plugins: ["@mysticatea"],
- parserOptions: {
- ecmaVersion: 5,
- sourceType: "script",
- },
- globals: {
- Intl: "readonly",
- clearInterval: "readonly",
- clearTimeout: "readonly",
- console: "readonly",
- setInterval: "readonly",
- setTimeout: "readonly",
- },
rules: {
- // Enabled rules
- "accessor-pairs": ["error", { enforceForClassMembers: true }],
- "array-callback-return": "error",
- camelcase: "error",
- "consistent-return": "error",
- curly: "error",
- "default-case": "error",
- "default-param-last": "error",
- "dot-notation": "error",
- eqeqeq: ["error", "always", { null: "ignore" }],
- "for-direction": "error",
- "func-style": ["error", "declaration"],
- "getter-return": "error",
- "init-declarations": "error",
- "linebreak-style": ["error", "unix"],
- "lines-between-class-members": "error",
- "max-statements-per-line": ["error", { max: 1 }],
- "multiline-comment-style": ["error", "separate-lines"],
- "new-cap": "error",
- "no-alert": "error",
- "no-array-constructor": "error",
- "no-async-promise-executor": "error",
- "no-caller": "error",
- "no-case-declarations": "error",
- "no-compare-neg-zero": "error",
- "no-cond-assign": "error",
- "no-constant-condition": "error",
- "no-control-regex": "error",
- "no-debugger": "error",
- "no-delete-var": "error",
- "no-div-regex": "error",
- "no-dupe-args": "error",
- "no-dupe-keys": "error",
- "no-duplicate-case": "error",
- "no-else-return": "error",
- "no-empty": "error",
- "no-empty-character-class": "error",
- "no-empty-function": "error",
- "no-empty-pattern": "error",
- "no-eval": "error",
- "no-ex-assign": "error",
- "no-extend-native": "error",
- "no-extra-bind": "error",
- "no-extra-boolean-cast": "error",
- "no-extra-label": "error",
- "no-fallthrough": "error",
- "no-func-assign": "error",
- "no-global-assign": "error",
- "no-implicit-coercion": "error",
- "no-implicit-globals": "error",
- "no-implied-eval": "error",
- "no-import-assign": "error",
- "no-inner-declarations": ["error", "functions"],
- "no-invalid-regexp": "error",
- "no-invalid-this": "error",
- "no-irregular-whitespace": [
- "error",
- {
- skipComments: false,
- skipRegExps: false,
- skipStrings: false,
- skipTemplates: false,
- },
- ],
- "no-iterator": "error",
- "no-label-var": "error",
- "no-lone-blocks": "error",
- "no-lonely-if": "error",
- "no-loop-func": "error",
- "no-misleading-character-class": "error",
- "no-mixed-operators": [
- "error",
- {
- groups: [
- ["&", "|", "^", "~", "<<", ">>", ">>>"],
- ["&&", "||"],
- ],
- },
- ],
- "no-new": "error",
- "no-new-object": "error",
- "no-new-require": "error",
- "no-new-wrappers": "error",
- "no-obj-calls": "error",
- "no-octal": "error",
- "no-octal-escape": "error",
- "no-param-reassign": ["error", { props: false }],
- "no-process-env": "error",
- "no-process-exit": "error",
- "no-prototype-builtins": "error",
- "no-redeclare": ["error", { builtinGlobals: true }],
- "no-regex-spaces": "error",
- "no-restricted-properties": [
- "error",
- { property: "__count__" },
- { property: "__noSuchMethod__" },
- { property: "__parent__" },
- { property: "__defineGetter__" },
- { property: "__defineSetter__" },
- { property: "__lookupGetter__" },
- { property: "__lookupSetter__" },
- ],
- "no-return-assign": "error",
- "no-return-await": "error",
- "no-script-url": "error",
- "no-self-assign": ["error", { props: true }],
- "no-self-compare": "error",
- "no-sequences": "error",
- "no-shadow": ["error", { builtinGlobals: true }],
- "no-shadow-restricted-names": "error",
- "no-sparse-arrays": "error",
- "no-tabs": "error",
- "no-throw-literal": "error",
- "no-undef": ["error", { typeof: true }],
- "no-unexpected-multiline": "error",
- "no-unmodified-loop-condition": "error",
- "no-unneeded-ternary": "error",
- "no-unreachable": "error",
- "no-unsafe-finally": "error",
- "no-unsafe-negation": ["error", { enforceForOrderingRelations: true }],
- "no-unused-expressions": "error",
- "no-unused-labels": "error",
- "no-unused-vars": [
- "error",
- {
- args: "all",
- argsIgnorePattern: "^_(?:[^_].*)?$",
- caughtErrors: "all",
- vars: "all",
- varsIgnorePattern: "^_(?:[^_].*)?$",
- },
- ],
- "no-use-before-define": ["error", "nofunc"],
- "no-useless-call": "error",
- "no-useless-catch": "error",
- "no-useless-concat": "error",
- "no-useless-escape": "error",
- "no-useless-return": "error",
- "no-void": "error",
- "no-with": "error",
- "one-var": [
- "error",
- {
- initialized: "never",
- uninitialized: "always",
- },
- ],
- "padding-line-between-statements": [
- "error",
- { blankLine: "always", next: "*", prev: "directive" },
- { blankLine: "always", next: "function", prev: "*" },
- { blankLine: "always", next: "*", prev: "function" },
- ],
- "prefer-promise-reject-errors": "error",
- "prefer-regex-literals": "error",
- quotes: ["error", "double", { avoidEscape: true }],
- radix: "error",
- "require-atomic-updates": "error",
- "require-await": "error",
- "spaced-comment": [
- "error",
- "always",
- {
- block: {
- balanced: true,
- markers: [
- "eslint",
- "eslint-env",
- "eslint-disable",
- "eslint-enable",
- "exported",
- "globals",
- "istanbul",
- ],
- },
- line: {
- exceptions: ["-", "="],
- markers: [
- "eslint-disable-line",
- "eslint-disable-next-line",
- "istanbul",
- "TODO:",
- "FIXME:",
- ],
- },
- },
- ],
- strict: ["error", "global"],
- "use-isnan": [
- "error",
- { enforceForIndexOf: true, enforceForSwitchCase: true },
- ],
- "valid-typeof": ["error", { requireStringLiterals: true }],
- yoda: ["error", "never", { exceptRange: true }],
-
- // Enabled rules as warnings.
- complexity: ["warn", { max: 16 }],
- "max-nested-callbacks": ["warn", { max: 4 }],
- "max-params": ["warn", { max: 8 }],
- "no-console": ["warn", { allow: ["assert", "error"] }],
-
- // Disabled rules as favor of Prettier.
- "array-bracket-newline": "off",
- "array-bracket-spacing": "off",
- "array-element-newline": "off",
- "arrow-parens": "off",
- "arrow-spacing": "off",
- "block-spacing": "off",
- "brace-style": "off",
- "comma-dangle": "off",
- "comma-spacing": "off",
- "comma-style": "off",
- "computed-property-spacing": "off",
- "dot-location": "off",
- "eol-last": "off",
- "func-call-spacing": "off",
- "function-call-argument-newline": "off",
- "function-paren-newline": "off",
- "generator-star-spacing": "off",
- "implicit-arrow-linebreak": "off",
- indent: "off",
- "jsx-quotes": "off",
- "key-spacing": "off",
- "keyword-spacing": "off",
- "multiline-ternary": "off",
- "new-parens": "off",
- "newline-per-chained-call": "off",
- "no-extra-parens": "off",
- "no-extra-semi": "off",
- "no-floating-decimal": "off",
- "no-mixed-spaces-and-tabs": "off",
- "no-multi-spaces": "off",
- "no-multiple-empty-lines": "off",
- "no-trailing-spaces": "off",
- "no-whitespace-before-property": "off",
- "nonblock-statement-body-position": "off",
- "object-curly-newline": "off",
- "object-curly-spacing": "off",
- "object-property-newline": "off",
- "one-var-declaration-per-line": "off",
- "operator-linebreak": "off",
- "padded-blocks": "off",
- "quote-props": "off",
- "rest-spread-spacing": "off",
- semi: "off",
- "semi-spacing": "off",
- "semi-style": "off",
- "space-before-blocks": "off",
- "space-before-function-paren": "off",
- "space-in-parens": "off",
- "space-infix-ops": "off",
- "space-unary-ops": "off",
- "switch-colon-spacing": "off",
- "template-curly-spacing": "off",
- "template-tag-spacing": "off",
- "unicode-bom": "off",
- "wrap-iife": "off",
- "wrap-regex": "off",
- "yield-star-spacing": "off",
-
- // Disabled rules
- "arrow-body-style": "off",
- "block-scoped-var": "off",
- "callback-return": "off",
- "capitalized-comments": "off",
- "class-methods-use-this": "off",
- "consistent-this": "off",
- "constructor-super": "off",
- "func-name-matching": "off",
- "func-names": "off",
- "global-require": "off",
- "guard-for-in": "off",
- "handle-callback-err": "off",
- "id-blacklist": "off",
- "id-length": "off",
- "id-match": "off",
- "line-comment-position": "off",
- "lines-around-comment": "off",
- "max-classes-per-file": "off",
- "max-depth": "off",
- "max-len": "off",
- "max-lines": "off",
- "max-lines-per-function": "off",
- "max-statements": "off",
- "no-await-in-loop": "off",
- "no-bitwise": "off",
- "no-buffer-constructor": "off",
- "no-class-assign": "off",
- "no-confusing-arrow": "off",
- "no-const-assign": "off",
- "no-continue": "off",
- "no-dupe-class-members": "off",
- "no-duplicate-imports": "off",
- "no-eq-null": "off",
- "no-inline-comments": "off",
- "no-labels": "off",
- "no-magic-numbers": "off",
- "no-mixed-requires": "off",
- "no-multi-assign": "off",
- "no-multi-str": "off",
- "no-negated-condition": "off",
- "no-nested-ternary": "off",
- "no-new-func": "off",
- "no-new-symbol": "off",
- "no-path-concat": "off",
- "no-plusplus": "off",
- "no-proto": "off",
- "no-restricted-globals": "off",
- "no-restricted-imports": "off",
- "no-restricted-modules": "off",
- "no-restricted-syntax": "off",
- "no-sync": "off",
- "no-template-curly-in-string": "off",
- "no-ternary": "off",
- "no-this-before-super": "off",
- "no-undef-init": "off",
- "no-undefined": "off",
- "no-underscore-dangle": "off",
- "no-useless-computed-key": "off",
- "no-useless-constructor": "off",
- "no-useless-rename": "off",
- "no-var": "off",
- "no-warning-comments": "off",
- "object-shorthand": "off",
- "operator-assignment": "off",
- "prefer-arrow-callback": "off",
- "prefer-const": "off",
- "prefer-destructuring": "off",
- "prefer-named-capture-group": "off",
- "prefer-numeric-literals": "off",
- "prefer-rest-params": "off",
- "prefer-object-spread": "off",
- "prefer-spread": "off",
- "prefer-template": "off",
- "require-yield": "off",
- "require-unicode-regexp": "off",
- "sort-imports": "off",
- "sort-keys": "off",
- "sort-vars": "off",
- "symbol-description": "off",
- "vars-on-top": "off",
-
- //
- // Plugins
- //
-
- // eslint-comments
- "@mysticatea/eslint-comments/disable-enable-pair": "error",
- "@mysticatea/eslint-comments/no-aggregating-enable": "error",
- "@mysticatea/eslint-comments/no-duplicate-disable": "error",
- "@mysticatea/eslint-comments/no-restricted-disable": "off",
- "@mysticatea/eslint-comments/no-unlimited-disable": "error",
- "@mysticatea/eslint-comments/no-unused-disable": "error",
- "@mysticatea/eslint-comments/no-unused-enable": "error",
- "@mysticatea/eslint-comments/no-use": [
- "error",
- {
- allow: [
- "eslint-disable",
- "eslint-disable-line",
- "eslint-disable-next-line",
- "eslint-enable",
- "eslint-env",
- "globals",
- ],
- },
- ],
-
- // prettier
- "@mysticatea/prettier": [
- "error",
- {
- tabWidth: 4,
- semi: false,
- trailingComma: "es5",
- },
- {
- usePrettierrc: false,
- },
- ],
-
- // my own
"@mysticatea/arrow-parens": "off",
"@mysticatea/block-scoped-var": "error",
"@mysticatea/no-instanceof-array": "error",
diff --git a/lib/configs/_browser-globals.js b/lib/configs/_browser-globals.js
deleted file mode 100644
index e4cba16..0000000
--- a/lib/configs/_browser-globals.js
+++ /dev/null
@@ -1,533 +0,0 @@
-// DON'T EDIT THIS FILE WHICH WAS GENERATED BY './scripts/generate-browser-globals.js'.
-"use strict"
-
-module.exports = {
- AbortController: "readonly",
- AbortSignal: "readonly",
- AnalyserNode: "readonly",
- Animation: "readonly",
- AnimationEffectReadOnly: "readonly",
- AnimationEffectTiming: "readonly",
- AnimationEffectTimingReadOnly: "readonly",
- AnimationEvent: "readonly",
- AnimationPlaybackEvent: "readonly",
- AnimationTimeline: "readonly",
- ApplicationCache: "readonly",
- ApplicationCacheErrorEvent: "readonly",
- Attr: "readonly",
- Audio: "readonly",
- AudioBuffer: "readonly",
- AudioBufferSourceNode: "readonly",
- AudioContext: "readonly",
- AudioDestinationNode: "readonly",
- AudioListener: "readonly",
- AudioNode: "readonly",
- AudioParam: "readonly",
- AudioProcessingEvent: "readonly",
- AudioScheduledSourceNode: "readonly",
- "AudioWorkletGlobalScope ": "readonly",
- AudioWorkletNode: "readonly",
- AudioWorkletProcessor: "readonly",
- BarProp: "readonly",
- BaseAudioContext: "readonly",
- BatteryManager: "readonly",
- BeforeUnloadEvent: "readonly",
- BiquadFilterNode: "readonly",
- Blob: "readonly",
- BlobEvent: "readonly",
- BroadcastChannel: "readonly",
- BudgetService: "readonly",
- ByteLengthQueuingStrategy: "readonly",
- CSS: "readonly",
- CSSConditionRule: "readonly",
- CSSFontFaceRule: "readonly",
- CSSGroupingRule: "readonly",
- CSSImportRule: "readonly",
- CSSKeyframeRule: "readonly",
- CSSKeyframesRule: "readonly",
- CSSMediaRule: "readonly",
- CSSNamespaceRule: "readonly",
- CSSPageRule: "readonly",
- CSSRule: "readonly",
- CSSRuleList: "readonly",
- CSSStyleDeclaration: "readonly",
- CSSStyleRule: "readonly",
- CSSStyleSheet: "readonly",
- CSSSupportsRule: "readonly",
- Cache: "readonly",
- CacheStorage: "readonly",
- CanvasCaptureMediaStreamTrack: "readonly",
- CanvasGradient: "readonly",
- CanvasPattern: "readonly",
- CanvasRenderingContext2D: "readonly",
- ChannelMergerNode: "readonly",
- ChannelSplitterNode: "readonly",
- CharacterData: "readonly",
- ClipboardEvent: "readonly",
- CloseEvent: "readonly",
- Comment: "readonly",
- CompositionEvent: "readonly",
- ConstantSourceNode: "readonly",
- ConvolverNode: "readonly",
- CountQueuingStrategy: "readonly",
- Credential: "readonly",
- CredentialsContainer: "readonly",
- Crypto: "readonly",
- CryptoKey: "readonly",
- CustomElementRegistry: "readonly",
- CustomEvent: "readonly",
- DOMError: "readonly",
- DOMException: "readonly",
- DOMImplementation: "readonly",
- DOMMatrix: "readonly",
- DOMMatrixReadOnly: "readonly",
- DOMParser: "readonly",
- DOMPoint: "readonly",
- DOMPointReadOnly: "readonly",
- DOMQuad: "readonly",
- DOMRect: "readonly",
- DOMRectReadOnly: "readonly",
- DOMStringList: "readonly",
- DOMStringMap: "readonly",
- DOMTokenList: "readonly",
- DataTransfer: "readonly",
- DataTransferItem: "readonly",
- DataTransferItemList: "readonly",
- DelayNode: "readonly",
- DeviceMotionEvent: "readonly",
- DeviceOrientationEvent: "readonly",
- Document: "readonly",
- DocumentFragment: "readonly",
- DocumentType: "readonly",
- DragEvent: "readonly",
- DynamicsCompressorNode: "readonly",
- Element: "readonly",
- ErrorEvent: "readonly",
- Event: "readonly",
- EventSource: "readonly",
- EventTarget: "readonly",
- File: "readonly",
- FileList: "readonly",
- FileReader: "readonly",
- FocusEvent: "readonly",
- FontFace: "readonly",
- FontFaceSetLoadEvent: "readonly",
- FormData: "readonly",
- GainNode: "readonly",
- Gamepad: "readonly",
- GamepadButton: "readonly",
- GamepadEvent: "readonly",
- HTMLAllCollection: "readonly",
- HTMLAnchorElement: "readonly",
- HTMLAreaElement: "readonly",
- HTMLAudioElement: "readonly",
- HTMLBRElement: "readonly",
- HTMLBaseElement: "readonly",
- HTMLBodyElement: "readonly",
- HTMLButtonElement: "readonly",
- HTMLCanvasElement: "readonly",
- HTMLCollection: "readonly",
- HTMLContentElement: "readonly",
- HTMLDListElement: "readonly",
- HTMLDataElement: "readonly",
- HTMLDataListElement: "readonly",
- HTMLDetailsElement: "readonly",
- HTMLDialogElement: "readonly",
- HTMLDirectoryElement: "readonly",
- HTMLDivElement: "readonly",
- HTMLDocument: "readonly",
- HTMLElement: "readonly",
- HTMLEmbedElement: "readonly",
- HTMLFieldSetElement: "readonly",
- HTMLFontElement: "readonly",
- HTMLFormControlsCollection: "readonly",
- HTMLFormElement: "readonly",
- HTMLFrameElement: "readonly",
- HTMLFrameSetElement: "readonly",
- HTMLHRElement: "readonly",
- HTMLHeadElement: "readonly",
- HTMLHeadingElement: "readonly",
- HTMLHtmlElement: "readonly",
- HTMLIFrameElement: "readonly",
- HTMLImageElement: "readonly",
- HTMLInputElement: "readonly",
- HTMLLIElement: "readonly",
- HTMLLabelElement: "readonly",
- HTMLLegendElement: "readonly",
- HTMLLinkElement: "readonly",
- HTMLMapElement: "readonly",
- HTMLMarqueeElement: "readonly",
- HTMLMediaElement: "readonly",
- HTMLMenuElement: "readonly",
- HTMLMetaElement: "readonly",
- HTMLMeterElement: "readonly",
- HTMLModElement: "readonly",
- HTMLOListElement: "readonly",
- HTMLObjectElement: "readonly",
- HTMLOptGroupElement: "readonly",
- HTMLOptionElement: "readonly",
- HTMLOptionsCollection: "readonly",
- HTMLOutputElement: "readonly",
- HTMLParagraphElement: "readonly",
- HTMLParamElement: "readonly",
- HTMLPictureElement: "readonly",
- HTMLPreElement: "readonly",
- HTMLProgressElement: "readonly",
- HTMLQuoteElement: "readonly",
- HTMLScriptElement: "readonly",
- HTMLSelectElement: "readonly",
- HTMLShadowElement: "readonly",
- HTMLSlotElement: "readonly",
- HTMLSourceElement: "readonly",
- HTMLSpanElement: "readonly",
- HTMLStyleElement: "readonly",
- HTMLTableCaptionElement: "readonly",
- HTMLTableCellElement: "readonly",
- HTMLTableColElement: "readonly",
- HTMLTableElement: "readonly",
- HTMLTableRowElement: "readonly",
- HTMLTableSectionElement: "readonly",
- HTMLTemplateElement: "readonly",
- HTMLTextAreaElement: "readonly",
- HTMLTimeElement: "readonly",
- HTMLTitleElement: "readonly",
- HTMLTrackElement: "readonly",
- HTMLUListElement: "readonly",
- HTMLUnknownElement: "readonly",
- HTMLVideoElement: "readonly",
- HashChangeEvent: "readonly",
- Headers: "readonly",
- History: "readonly",
- IDBCursor: "readonly",
- IDBCursorWithValue: "readonly",
- IDBDatabase: "readonly",
- IDBFactory: "readonly",
- IDBIndex: "readonly",
- IDBKeyRange: "readonly",
- IDBObjectStore: "readonly",
- IDBOpenDBRequest: "readonly",
- IDBRequest: "readonly",
- IDBTransaction: "readonly",
- IDBVersionChangeEvent: "readonly",
- IIRFilterNode: "readonly",
- IdleDeadline: "readonly",
- Image: "readonly",
- ImageBitmap: "readonly",
- ImageBitmapRenderingContext: "readonly",
- ImageCapture: "readonly",
- ImageData: "readonly",
- InputEvent: "readonly",
- IntersectionObserver: "readonly",
- IntersectionObserverEntry: "readonly",
- Intl: "readonly",
- KeyboardEvent: "readonly",
- KeyframeEffect: "readonly",
- KeyframeEffectReadOnly: "readonly",
- Location: "readonly",
- MIDIAccess: "readonly",
- MIDIConnectionEvent: "readonly",
- MIDIInput: "readonly",
- MIDIInputMap: "readonly",
- MIDIMessageEvent: "readonly",
- MIDIOutput: "readonly",
- MIDIOutputMap: "readonly",
- MIDIPort: "readonly",
- MediaDeviceInfo: "readonly",
- MediaDevices: "readonly",
- MediaElementAudioSourceNode: "readonly",
- MediaEncryptedEvent: "readonly",
- MediaError: "readonly",
- MediaKeyMessageEvent: "readonly",
- MediaKeySession: "readonly",
- MediaKeyStatusMap: "readonly",
- MediaKeySystemAccess: "readonly",
- MediaList: "readonly",
- MediaQueryList: "readonly",
- MediaQueryListEvent: "readonly",
- MediaRecorder: "readonly",
- MediaSettingsRange: "readonly",
- MediaSource: "readonly",
- MediaStream: "readonly",
- MediaStreamAudioDestinationNode: "readonly",
- MediaStreamAudioSourceNode: "readonly",
- MediaStreamEvent: "readonly",
- MediaStreamTrack: "readonly",
- MediaStreamTrackEvent: "readonly",
- MessageChannel: "readonly",
- MessageEvent: "readonly",
- MessagePort: "readonly",
- MimeType: "readonly",
- MimeTypeArray: "readonly",
- MouseEvent: "readonly",
- MutationEvent: "readonly",
- MutationObserver: "readonly",
- MutationRecord: "readonly",
- NamedNodeMap: "readonly",
- NavigationPreloadManager: "readonly",
- Navigator: "readonly",
- NetworkInformation: "readonly",
- Node: "readonly",
- NodeFilter: "readonly",
- NodeIterator: "readonly",
- NodeList: "readonly",
- Notification: "readonly",
- OfflineAudioCompletionEvent: "readonly",
- OfflineAudioContext: "readonly",
- OffscreenCanvas: "writable",
- Option: "readonly",
- OscillatorNode: "readonly",
- PageTransitionEvent: "readonly",
- PannerNode: "readonly",
- Path2D: "readonly",
- PaymentAddress: "readonly",
- PaymentRequest: "readonly",
- PaymentRequestUpdateEvent: "readonly",
- PaymentResponse: "readonly",
- Performance: "readonly",
- PerformanceEntry: "readonly",
- PerformanceLongTaskTiming: "readonly",
- PerformanceMark: "readonly",
- PerformanceMeasure: "readonly",
- PerformanceNavigation: "readonly",
- PerformanceNavigationTiming: "readonly",
- PerformanceObserver: "readonly",
- PerformanceObserverEntryList: "readonly",
- PerformancePaintTiming: "readonly",
- PerformanceResourceTiming: "readonly",
- PerformanceTiming: "readonly",
- PeriodicWave: "readonly",
- PermissionStatus: "readonly",
- Permissions: "readonly",
- PhotoCapabilities: "readonly",
- Plugin: "readonly",
- PluginArray: "readonly",
- PointerEvent: "readonly",
- PopStateEvent: "readonly",
- Presentation: "readonly",
- PresentationAvailability: "readonly",
- PresentationConnection: "readonly",
- PresentationConnectionAvailableEvent: "readonly",
- PresentationConnectionCloseEvent: "readonly",
- PresentationConnectionList: "readonly",
- PresentationReceiver: "readonly",
- PresentationRequest: "readonly",
- ProcessingInstruction: "readonly",
- ProgressEvent: "readonly",
- PromiseRejectionEvent: "readonly",
- PushManager: "readonly",
- PushSubscription: "readonly",
- PushSubscriptionOptions: "readonly",
- RTCCertificate: "readonly",
- RTCDataChannel: "readonly",
- RTCDataChannelEvent: "readonly",
- RTCDtlsTransport: "readonly",
- RTCIceCandidate: "readonly",
- RTCIceGatherer: "readonly",
- RTCIceTransport: "readonly",
- RTCPeerConnection: "readonly",
- RTCPeerConnectionIceEvent: "readonly",
- RTCRtpContributingSource: "readonly",
- RTCRtpReceiver: "readonly",
- RTCRtpSender: "readonly",
- RTCSctpTransport: "readonly",
- RTCSessionDescription: "readonly",
- RTCStatsReport: "readonly",
- RTCTrackEvent: "readonly",
- RadioNodeList: "readonly",
- Range: "readonly",
- ReadableStream: "readonly",
- RemotePlayback: "readonly",
- Request: "readonly",
- ResizeObserver: "readonly",
- ResizeObserverEntry: "readonly",
- Response: "readonly",
- SVGAElement: "readonly",
- SVGAngle: "readonly",
- SVGAnimateElement: "readonly",
- SVGAnimateMotionElement: "readonly",
- SVGAnimateTransformElement: "readonly",
- SVGAnimatedAngle: "readonly",
- SVGAnimatedBoolean: "readonly",
- SVGAnimatedEnumeration: "readonly",
- SVGAnimatedInteger: "readonly",
- SVGAnimatedLength: "readonly",
- SVGAnimatedLengthList: "readonly",
- SVGAnimatedNumber: "readonly",
- SVGAnimatedNumberList: "readonly",
- SVGAnimatedPreserveAspectRatio: "readonly",
- SVGAnimatedRect: "readonly",
- SVGAnimatedString: "readonly",
- SVGAnimatedTransformList: "readonly",
- SVGAnimationElement: "readonly",
- SVGCircleElement: "readonly",
- SVGClipPathElement: "readonly",
- SVGComponentTransferFunctionElement: "readonly",
- SVGDefsElement: "readonly",
- SVGDescElement: "readonly",
- SVGDiscardElement: "readonly",
- SVGElement: "readonly",
- SVGEllipseElement: "readonly",
- SVGFEBlendElement: "readonly",
- SVGFEColorMatrixElement: "readonly",
- SVGFEComponentTransferElement: "readonly",
- SVGFECompositeElement: "readonly",
- SVGFEConvolveMatrixElement: "readonly",
- SVGFEDiffuseLightingElement: "readonly",
- SVGFEDisplacementMapElement: "readonly",
- SVGFEDistantLightElement: "readonly",
- SVGFEDropShadowElement: "readonly",
- SVGFEFloodElement: "readonly",
- SVGFEFuncAElement: "readonly",
- SVGFEFuncBElement: "readonly",
- SVGFEFuncGElement: "readonly",
- SVGFEFuncRElement: "readonly",
- SVGFEGaussianBlurElement: "readonly",
- SVGFEImageElement: "readonly",
- SVGFEMergeElement: "readonly",
- SVGFEMergeNodeElement: "readonly",
- SVGFEMorphologyElement: "readonly",
- SVGFEOffsetElement: "readonly",
- SVGFEPointLightElement: "readonly",
- SVGFESpecularLightingElement: "readonly",
- SVGFESpotLightElement: "readonly",
- SVGFETileElement: "readonly",
- SVGFETurbulenceElement: "readonly",
- SVGFilterElement: "readonly",
- SVGForeignObjectElement: "readonly",
- SVGGElement: "readonly",
- SVGGeometryElement: "readonly",
- SVGGradientElement: "readonly",
- SVGGraphicsElement: "readonly",
- SVGImageElement: "readonly",
- SVGLength: "readonly",
- SVGLengthList: "readonly",
- SVGLineElement: "readonly",
- SVGLinearGradientElement: "readonly",
- SVGMPathElement: "readonly",
- SVGMarkerElement: "readonly",
- SVGMaskElement: "readonly",
- SVGMatrix: "readonly",
- SVGMetadataElement: "readonly",
- SVGNumber: "readonly",
- SVGNumberList: "readonly",
- SVGPathElement: "readonly",
- SVGPatternElement: "readonly",
- SVGPoint: "readonly",
- SVGPointList: "readonly",
- SVGPolygonElement: "readonly",
- SVGPolylineElement: "readonly",
- SVGPreserveAspectRatio: "readonly",
- SVGRadialGradientElement: "readonly",
- SVGRect: "readonly",
- SVGRectElement: "readonly",
- SVGSVGElement: "readonly",
- SVGScriptElement: "readonly",
- SVGSetElement: "readonly",
- SVGStopElement: "readonly",
- SVGStringList: "readonly",
- SVGStyleElement: "readonly",
- SVGSwitchElement: "readonly",
- SVGSymbolElement: "readonly",
- SVGTSpanElement: "readonly",
- SVGTextContentElement: "readonly",
- SVGTextElement: "readonly",
- SVGTextPathElement: "readonly",
- SVGTextPositioningElement: "readonly",
- SVGTitleElement: "readonly",
- SVGTransform: "readonly",
- SVGTransformList: "readonly",
- SVGUnitTypes: "readonly",
- SVGUseElement: "readonly",
- SVGViewElement: "readonly",
- Screen: "readonly",
- ScreenOrientation: "readonly",
- ScriptProcessorNode: "readonly",
- SecurityPolicyViolationEvent: "readonly",
- Selection: "readonly",
- ServiceWorker: "readonly",
- ServiceWorkerContainer: "readonly",
- ServiceWorkerRegistration: "readonly",
- ShadowRoot: "readonly",
- SharedWorker: "readonly",
- SourceBuffer: "readonly",
- SourceBufferList: "readonly",
- SpeechSynthesisEvent: "readonly",
- SpeechSynthesisUtterance: "readonly",
- StaticRange: "readonly",
- StereoPannerNode: "readonly",
- Storage: "readonly",
- StorageEvent: "readonly",
- StorageManager: "readonly",
- StyleSheet: "readonly",
- StyleSheetList: "readonly",
- SubtleCrypto: "readonly",
- TaskAttributionTiming: "readonly",
- Text: "readonly",
- TextDecoder: "readonly",
- TextEncoder: "readonly",
- TextEvent: "readonly",
- TextMetrics: "readonly",
- TextTrack: "readonly",
- TextTrackCue: "readonly",
- TextTrackCueList: "readonly",
- TextTrackList: "readonly",
- TimeRanges: "readonly",
- Touch: "readonly",
- TouchEvent: "readonly",
- TouchList: "readonly",
- TrackEvent: "readonly",
- TransitionEvent: "readonly",
- TreeWalker: "readonly",
- UIEvent: "readonly",
- URL: "readonly",
- URLSearchParams: "readonly",
- VTTCue: "readonly",
- ValidityState: "readonly",
- VisualViewport: "readonly",
- WaveShaperNode: "readonly",
- WebAssembly: "readonly",
- WebGL2RenderingContext: "readonly",
- WebGLActiveInfo: "readonly",
- WebGLBuffer: "readonly",
- WebGLContextEvent: "readonly",
- WebGLFramebuffer: "readonly",
- WebGLProgram: "readonly",
- WebGLQuery: "readonly",
- WebGLRenderbuffer: "readonly",
- WebGLRenderingContext: "readonly",
- WebGLSampler: "readonly",
- WebGLShader: "readonly",
- WebGLShaderPrecisionFormat: "readonly",
- WebGLSync: "readonly",
- WebGLTexture: "readonly",
- WebGLTransformFeedback: "readonly",
- WebGLUniformLocation: "readonly",
- WebGLVertexArrayObject: "readonly",
- WebSocket: "readonly",
- WheelEvent: "readonly",
- Window: "readonly",
- Worker: "readonly",
- WritableStream: "readonly",
- XMLDocument: "readonly",
- XMLHttpRequest: "readonly",
- XMLHttpRequestEventTarget: "readonly",
- XMLHttpRequestUpload: "readonly",
- XMLSerializer: "readonly",
- XPathEvaluator: "readonly",
- XPathExpression: "readonly",
- XPathResult: "readonly",
- XSLTProcessor: "readonly",
- atob: "readonly",
- btoa: "readonly",
- cancelAnimationFrame: "readonly",
- document: "readonly",
- fetch: "readonly",
- indexedDB: "readonly",
- localStorage: "readonly",
- location: "writable",
- matchMedia: "readonly",
- navigator: "readonly",
- requestAnimationFrame: "readonly",
- sessionStorage: "readonly",
- window: "readonly",
-}
diff --git a/lib/configs/_override-2015.js b/lib/configs/_override-2015.js
index a76f575..f6d81aa 100644
--- a/lib/configs/_override-2015.js
+++ b/lib/configs/_override-2015.js
@@ -5,85 +5,7 @@
"use strict"
module.exports = {
- parserOptions: {
- ecmaVersion: 2015,
- },
- globals: {
- ArrayBuffer: "readonly",
- DataView: "readonly",
- Float32Array: "readonly",
- Float64Array: "readonly",
- Int16Array: "readonly",
- Int32Array: "readonly",
- Int8Array: "readonly",
- Map: "readonly",
- Promise: "readonly",
- Proxy: "readonly",
- Reflect: "readonly",
- Set: "readonly",
- Symbol: "readonly",
- Uint16Array: "readonly",
- Uint32Array: "readonly",
- Uint8Array: "readonly",
- Uint8ClampedArray: "readonly",
- WeakMap: "readonly",
- WeakSet: "readonly",
- },
rules: {
- // Enabled rules as errors
- "arrow-body-style": "error",
- "constructor-super": "error",
- "default-param-last": "error",
- "no-class-assign": "error",
- "no-const-assign": "error",
- "no-dupe-class-members": "error",
- "no-duplicate-imports": ["error", { includeExports: true }],
- "no-import-assign": "error",
- "no-new-symbol": "error",
- "no-template-curly-in-string": "error",
- "no-this-before-super": "error",
- "no-useless-computed-key": "error",
- "no-useless-constructor": "error",
- "no-useless-rename": "error",
- "no-var": "error",
- "object-shorthand": [
- "error",
- "always",
- { avoidExplicitReturnArrows: true },
- ],
- "prefer-arrow-callback": "error",
- "prefer-const": "error",
- "prefer-numeric-literals": "error",
- "prefer-rest-params": "error",
- "prefer-spread": "error",
- "prefer-template": "error",
- "require-unicode-regexp": "error",
- "require-yield": "error",
- "symbol-description": "error",
-
- // Enabled rules as warnings
- "class-methods-use-this": "warn",
-
- // Disabled rules as favor of Prettier.
- "arrow-parens": "off",
- "arrow-spacing": "off",
- "generator-star-spacing": "off",
- "no-confusing-arrow": "off",
- "rest-spread-spacing": "off",
- "template-curly-spacing": "off",
- "yield-star-spacing": "off",
-
- // Desabled rules
- "no-inner-declarations": "off",
- "no-restricted-imports": "off",
- "prefer-destructuring": "off",
- "sort-imports": "off",
-
- //
- // Plugins
- //
-
- // my own
"@mysticatea/block-scoped-var": "off",
"@mysticatea/no-this-in-static": "error",
"@mysticatea/no-useless-rest-spread": "error",
diff --git a/lib/configs/_override-2016.js b/lib/configs/_override-2016.js
deleted file mode 100644
index f18db5f..0000000
--- a/lib/configs/_override-2016.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * @author Toru Nagashima
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-module.exports = {
- parserOptions: {
- ecmaVersion: 2016,
- },
-}
diff --git a/lib/configs/_override-2017.js b/lib/configs/_override-2017.js
deleted file mode 100644
index fb892c7..0000000
--- a/lib/configs/_override-2017.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * @author Toru Nagashima
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-module.exports = {
- parserOptions: {
- ecmaVersion: 2017,
- },
- globals: {
- Atomics: "readonly",
- SharedArrayBuffer: "readonly",
- },
- rules: {
- "@mysticatea/prettier": [
- "error",
- {
- tabWidth: 4,
- semi: false,
- trailingComma: "all",
- },
- {
- usePrettierrc: false,
- },
- ],
- },
-}
diff --git a/lib/configs/_override-2018.js b/lib/configs/_override-2018.js
deleted file mode 100644
index 5348dd0..0000000
--- a/lib/configs/_override-2018.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * @author Toru Nagashima
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-module.exports = {
- parserOptions: {
- ecmaVersion: 2018,
- },
- rules: {
- "prefer-object-spread": "error",
- },
-}
diff --git a/lib/configs/_override-2019.js b/lib/configs/_override-2019.js
deleted file mode 100644
index 1c33104..0000000
--- a/lib/configs/_override-2019.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * @author Toru Nagashima
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-module.exports = {
- parserOptions: {
- ecmaVersion: 2019,
- },
-}
diff --git a/lib/configs/_override-2020.js b/lib/configs/_override-2020.js
deleted file mode 100644
index 1db0423..0000000
--- a/lib/configs/_override-2020.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * @author Toru Nagashima
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-module.exports = {
- parserOptions: {
- ecmaVersion: 2020,
- },
- globals: {
- BigInt: "readonly",
- BigInt64Array: "readonly",
- BigUint64Array: "readonly",
- },
-}
diff --git a/lib/configs/_override-mocha.js b/lib/configs/_override-mocha.js
deleted file mode 100644
index 4d103e0..0000000
--- a/lib/configs/_override-mocha.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * @author Toru Nagashima
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-module.exports = {
- overrides: [
- {
- files: ["**/test/**", "**/tests/**"],
- globals: {
- after: "readonly",
- afterEach: "readonly",
- before: "readonly",
- beforeEach: "readonly",
- describe: "readonly",
- it: "readonly",
- mocha: "readonly",
- xdescribe: "readonly",
- xit: "readonly",
- },
- rules: {
- "max-nested-callbacks": "off",
- },
- },
- ],
-}
diff --git a/lib/configs/_override-special.js b/lib/configs/_override-special.js
deleted file mode 100644
index 17916c0..0000000
--- a/lib/configs/_override-special.js
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * @author Toru Nagashima
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-module.exports = {
- overrides: [
- {
- files: [
- "**/scripts/**/*",
- ".babelrc.js",
- ".eslintrc.js",
- "webpack.config.js",
- "**/.vuepress/config.js",
- "*.webpack.config.js",
- ],
- extends: [require.resolve("./+node.js")],
- rules: {
- "no-console": "off",
- "no-process-env": "off",
- },
- },
- {
- files: [
- "**/scripts/rollup-plugin/**/*",
- "rollup.config.js",
- "*.rollup.config.js",
- ],
- extends: [
- require.resolve("./+node.js"),
- require.resolve("./+modules.js"),
- ],
- rules: {
- "no-console": "off",
- "no-process-env": "off",
- },
- },
- ],
-}
diff --git a/lib/configs/_override-ts.js b/lib/configs/_override-ts.js
deleted file mode 100644
index 3b94d9a..0000000
--- a/lib/configs/_override-ts.js
+++ /dev/null
@@ -1,133 +0,0 @@
-/**
- * @author Toru Nagashima
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-module.exports = {
- overrides: [
- {
- files: ["*.ts", "*.tsx"],
- extends: [require.resolve("./+modules.js")],
- parser: require.resolve("@typescript-eslint/parser"),
- parserOptions: {
- loggerFn: false,
- project: "tsconfig.json",
- },
- rules: {
- // Enabled rules
- "@mysticatea/ts/adjacent-overload-signatures": "error",
- "@mysticatea/ts/array-type": "error",
- "@mysticatea/ts/await-thenable": "error",
- "@mysticatea/ts/ban-ts-ignore": "error",
- "@mysticatea/ts/class-name-casing": "error",
- "@mysticatea/ts/consistent-type-assertions": "error",
- "@mysticatea/ts/explicit-member-accessibility": "error",
- "@mysticatea/ts/interface-name-prefix": "error",
- "@mysticatea/ts/member-naming": "error",
- "@mysticatea/ts/no-array-constructor": "error",
- "@mysticatea/ts/no-empty-interface": "error",
- "@mysticatea/ts/no-extraneous-class": "error",
- "@mysticatea/ts/no-floating-promises": "error",
- "@mysticatea/ts/no-for-in-array": "error",
- "@mysticatea/ts/no-inferrable-types": "error",
- "@mysticatea/ts/no-misused-new": "error",
- "@mysticatea/ts/no-misused-promises": "error",
- "@mysticatea/ts/no-parameter-properties": "error",
- "@mysticatea/ts/no-require-imports": "error",
- "@mysticatea/ts/no-this-alias": [
- "error",
- { allowDestructuring: true },
- ],
- "@mysticatea/ts/no-unnecessary-qualifier": "error",
- "@mysticatea/ts/no-unnecessary-type-arguments": "error",
- "@mysticatea/ts/no-unnecessary-type-assertion": "error",
- "@mysticatea/ts/no-var-requires": "error",
- // https://github.com/typescript-eslint/typescript-eslint/issues/454
- "@mysticatea/ts/prefer-function-type": "off",
- "@mysticatea/ts/prefer-includes": "error",
- "@mysticatea/ts/prefer-namespace-keyword": "error",
- // https://github.com/typescript-eslint/typescript-eslint/issues/946
- "@mysticatea/ts/prefer-readonly": "off",
- "@mysticatea/ts/prefer-regexp-exec": "error",
- "@mysticatea/ts/prefer-string-starts-ends-with": "error",
- "@mysticatea/ts/restrict-plus-operands": "error",
- "@mysticatea/ts/require-array-sort-compare": "error",
- "@mysticatea/ts/triple-slash-reference": "error",
- // ăȘăăèȘ€æ€ç„ăć€ă...
- "@mysticatea/ts/unbound-method": [
- "off",
- { ignoreStatic: true },
- ],
- // https://github.com/typescript-eslint/typescript-eslint/issues/452
- "@mysticatea/ts/unified-signatures": "off",
- "@mysticatea/prettier": [
- "error",
- {
- tabWidth: 4,
- semi: false,
- trailingComma: "all",
- parser: "typescript",
- },
- {
- usePrettierrc: false,
- },
- ],
-
- // Replacements
- camelcase: "off",
- "@mysticatea/ts/camelcase": "error",
- "no-empty-function": "off",
- "@mysticatea/ts/no-empty-function": "error",
- "no-useless-constructor": "off",
- "@mysticatea/ts/no-useless-constructor": "error",
- "require-await": "off",
- "@mysticatea/ts/require-await": "error",
-
- // Disabled rules
- "func-style": "off",
- "init-declarations": "off",
- "lines-between-class-members": "off",
- "no-dupe-class-members": "off",
- "no-invalid-this": "off",
- "no-loop-func": "off",
- "no-redeclare": "off",
- "no-undef": "off",
- "no-unused-vars": "off",
- "no-use-before-define": "off",
- "one-var": "off",
- "@mysticatea/ts/ban-types": "off",
- "@mysticatea/ts/brace-style": "off", // favor of Prettier.
- "@mysticatea/ts/consistent-type-definitions": "off",
- "@mysticatea/ts/explicit-function-return-type": "off", // I want but this is not so...
- "@mysticatea/ts/func-call-spacing": "off", // favor of Prettier.
- "@mysticatea/ts/generic-type-naming": "off",
- "@mysticatea/ts/indent": "off", // favor of Prettier.
- "@mysticatea/ts/member-delimiter-style": "off", // favor of Prettier.
- "@mysticatea/ts/member-ordering": "off",
- "@mysticatea/ts/no-explicit-any": "off",
- "@mysticatea/ts/no-extra-parens": "off", // favor of Prettier.
- "@mysticatea/ts/no-magic-numbers": "off",
- "@mysticatea/ts/no-namespace": "off", // I like the namespace for interfaces (type only things).
- "@mysticatea/ts/no-non-null-assertion": "off",
- "@mysticatea/ts/no-type-alias": "off",
- "@mysticatea/ts/no-unnecessary-condition": "off", // This was problematic for test code.
- "@mysticatea/ts/no-unused-vars": "off", // tsc verifies it.
- "@mysticatea/ts/no-use-before-define": "off", // tsc verifies it.
- "@mysticatea/ts/prefer-for-of": "off",
- "@mysticatea/ts/promise-function-async": "off",
- "@mysticatea/ts/quotes": "off", // favor of Prettier.
- "@mysticatea/ts/semi": "off", // favor of Prettier.
- "@mysticatea/ts/strict-boolean-expressions": "off",
- "@mysticatea/ts/type-annotation-spacing": "off", // favor of Prettier.
- "@mysticatea/ts/typedef": "off",
- },
- },
- {
- files: ["*.d.ts"],
- rules: {
- strict: "off",
- },
- },
- ],
-}
diff --git a/lib/configs/_override-vue.js b/lib/configs/_override-vue.js
deleted file mode 100644
index 9d38f11..0000000
--- a/lib/configs/_override-vue.js
+++ /dev/null
@@ -1,141 +0,0 @@
-/**
- * @author Toru Nagashima
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-module.exports = {
- overrides: [
- {
- files: ["*.vue"],
- extends: [
- require.resolve("./+browser.js"),
- require.resolve("./+modules.js"),
- ],
- parser: require.resolve("vue-eslint-parser"),
- rules: {
- // Enabled rules
- "@mysticatea/vue/array-bracket-spacing": ["error", "never"],
- "@mysticatea/vue/arrow-spacing": "error",
- "@mysticatea/vue/block-spacing": "error",
- "@mysticatea/vue/brace-style": "error",
- "@mysticatea/vue/camelcase": "error",
- "@mysticatea/vue/comma-dangle": [
- "error",
- {
- arrays: "always",
- objects: "always",
- imports: "always",
- exports: "always",
- functions: "always",
- },
- ],
- "@mysticatea/vue/comment-directive": "error",
- "@mysticatea/vue/dot-location": "error",
- "@mysticatea/vue/eqeqeq": [
- "error",
- "always",
- { null: "ignore" },
- ],
- "@mysticatea/vue/jsx-uses-vars": "error",
- "@mysticatea/vue/key-spacing": "error",
- "@mysticatea/vue/keyword-spacing": "error",
- "@mysticatea/vue/match-component-file-name": "error",
- "@mysticatea/vue/max-attributes-per-line": [
- "error",
- {
- singleline: 3,
- multiline: {
- max: 1,
- allowFirstLine: false,
- },
- },
- ],
- "@mysticatea/vue/no-async-in-computed-properties": "error",
- "@mysticatea/vue/no-boolean-default": "error",
- "@mysticatea/vue/no-deprecated-scope-attribute": "error",
- "@mysticatea/vue/no-dupe-keys": "error",
- "@mysticatea/vue/no-duplicate-attributes": "error",
- "@mysticatea/vue/no-empty-pattern": "error",
- "@mysticatea/vue/no-parsing-error": "error",
- "@mysticatea/vue/no-reserved-keys": "error",
- "@mysticatea/vue/no-shared-component-data": "error",
- "@mysticatea/vue/no-side-effects-in-computed-properties":
- "error",
- "@mysticatea/vue/no-template-key": "error",
- "@mysticatea/vue/no-textarea-mustache": "error",
- "@mysticatea/vue/no-unused-vars": "error",
- "@mysticatea/vue/object-curly-spacing": ["error", "always"],
- "@mysticatea/vue/require-component-is": "error",
- "@mysticatea/vue/require-direct-export": "error",
- "@mysticatea/vue/require-render-return": "error",
- "@mysticatea/vue/require-v-for-key": "error",
- "@mysticatea/vue/require-valid-default-prop": "error",
- "@mysticatea/vue/return-in-computed-property": "error",
- "@mysticatea/vue/space-infix-ops": "error",
- "@mysticatea/vue/space-unary-ops": "error",
- "@mysticatea/vue/v-on-function-call": "error",
- "@mysticatea/vue/v-slot-style": "error",
- "@mysticatea/vue/valid-template-root": "error",
- "@mysticatea/vue/valid-v-bind": "error",
- "@mysticatea/vue/valid-v-cloak": "error",
- "@mysticatea/vue/valid-v-else-if": "error",
- "@mysticatea/vue/valid-v-else": "error",
- "@mysticatea/vue/valid-v-for": "error",
- "@mysticatea/vue/valid-v-html": "error",
- "@mysticatea/vue/valid-v-if": "error",
- "@mysticatea/vue/valid-v-model": "error",
- "@mysticatea/vue/valid-v-on": "error",
- "@mysticatea/vue/valid-v-once": "error",
- "@mysticatea/vue/valid-v-pre": "error",
- "@mysticatea/vue/valid-v-show": "error",
- "@mysticatea/vue/valid-v-slot": "error",
- "@mysticatea/vue/valid-v-text": "error",
- "@mysticatea/vue/attribute-hyphenation": "error",
- "@mysticatea/vue/html-end-tags": "error",
- "@mysticatea/vue/html-indent": ["error", 4],
- "@mysticatea/vue/html-self-closing": "error",
- "@mysticatea/vue/mustache-interpolation-spacing": "error",
- "@mysticatea/vue/name-property-casing": "error",
- "@mysticatea/vue/no-multi-spaces": "error",
- "@mysticatea/vue/require-default-prop": "error",
- "@mysticatea/vue/require-prop-types": "error",
- "@mysticatea/vue/v-bind-style": "error",
- "@mysticatea/vue/v-on-style": "error",
- "@mysticatea/vue/attributes-order": "error",
- "@mysticatea/vue/html-quotes": "error",
- "@mysticatea/vue/order-in-components": "error",
- "@mysticatea/vue/this-in-template": "error",
- "@mysticatea/vue/html-closing-bracket-newline": [
- "error",
- {
- singleline: "never",
- multiline: "always",
- },
- ],
- "@mysticatea/vue/html-closing-bracket-spacing": "error",
- "@mysticatea/vue/prop-name-casing": "error",
- "@mysticatea/vue/component-name-in-template-casing": [
- "error",
- "kebab-case",
- ],
- "@mysticatea/vue/multiline-html-element-content-newline":
- "error",
- "@mysticatea/vue/singleline-html-element-content-newline":
- "error",
- "@mysticatea/vue/no-spaces-around-equal-signs-in-attribute":
- "error",
- "@mysticatea/vue/no-template-shadow": "error",
- "@mysticatea/vue/no-unused-components": "error",
- "@mysticatea/vue/no-use-v-if-with-v-for": "error",
- "@mysticatea/vue/no-v-html": "error",
- "@mysticatea/vue/require-prop-type-constructor": "error",
- "@mysticatea/vue/use-v-on-exact": "error",
-
- // Disabled rules (prefer prettier)
- "@mysticatea/vue/no-restricted-syntax": "off",
- "@mysticatea/vue/script-indent": "off",
- },
- },
- ],
-}
diff --git a/lib/configs/+browser.js b/lib/configs/all.js
similarity index 53%
rename from lib/configs/+browser.js
rename to lib/configs/all.js
index 2d93674..1702d8c 100644
--- a/lib/configs/+browser.js
+++ b/lib/configs/all.js
@@ -4,8 +4,9 @@
*/
"use strict"
-const globals = require("./_browser-globals")
-
module.exports = {
- globals,
+ extends: [
+ require.resolve("./_base.js"),
+ require.resolve("./_override-2015.js"),
+ ],
}
diff --git a/lib/configs/es2015.js b/lib/configs/es2015.js
index f4fda18..1702d8c 100644
--- a/lib/configs/es2015.js
+++ b/lib/configs/es2015.js
@@ -8,9 +8,5 @@ module.exports = {
extends: [
require.resolve("./_base.js"),
require.resolve("./_override-2015.js"),
- require.resolve("./_override-ts.js"),
- require.resolve("./_override-vue.js"),
- require.resolve("./_override-mocha.js"),
- require.resolve("./_override-special.js"),
],
}
diff --git a/lib/configs/es2016.js b/lib/configs/es2016.js
deleted file mode 100644
index df18716..0000000
--- a/lib/configs/es2016.js
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * @author Toru Nagashima
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-module.exports = {
- extends: [
- require.resolve("./_base.js"),
- require.resolve("./_override-2015.js"),
- require.resolve("./_override-2016.js"),
- require.resolve("./_override-ts.js"),
- require.resolve("./_override-vue.js"),
- require.resolve("./_override-mocha.js"),
- require.resolve("./_override-special.js"),
- ],
-}
diff --git a/lib/configs/es2017.js b/lib/configs/es2017.js
deleted file mode 100644
index c96913c..0000000
--- a/lib/configs/es2017.js
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * @author Toru Nagashima
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-module.exports = {
- extends: [
- require.resolve("./_base.js"),
- require.resolve("./_override-2015.js"),
- require.resolve("./_override-2016.js"),
- require.resolve("./_override-2017.js"),
- require.resolve("./_override-ts.js"),
- require.resolve("./_override-vue.js"),
- require.resolve("./_override-mocha.js"),
- require.resolve("./_override-special.js"),
- ],
-}
diff --git a/lib/configs/es2018.js b/lib/configs/es2018.js
deleted file mode 100644
index 8e90f53..0000000
--- a/lib/configs/es2018.js
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * @author Toru Nagashima
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-module.exports = {
- extends: [
- require.resolve("./_base.js"),
- require.resolve("./_override-2015.js"),
- require.resolve("./_override-2016.js"),
- require.resolve("./_override-2017.js"),
- require.resolve("./_override-2018.js"),
- require.resolve("./_override-ts.js"),
- require.resolve("./_override-vue.js"),
- require.resolve("./_override-mocha.js"),
- require.resolve("./_override-special.js"),
- ],
-}
diff --git a/lib/configs/es2019.js b/lib/configs/es2019.js
deleted file mode 100644
index 11dafda..0000000
--- a/lib/configs/es2019.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * @author Toru Nagashima
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-module.exports = {
- extends: [
- require.resolve("./_base.js"),
- require.resolve("./_override-2015.js"),
- require.resolve("./_override-2016.js"),
- require.resolve("./_override-2017.js"),
- require.resolve("./_override-2018.js"),
- require.resolve("./_override-2019.js"),
- require.resolve("./_override-ts.js"),
- require.resolve("./_override-vue.js"),
- require.resolve("./_override-mocha.js"),
- require.resolve("./_override-special.js"),
- ],
-}
diff --git a/lib/configs/es2020.js b/lib/configs/es2020.js
deleted file mode 100644
index 64322a2..0000000
--- a/lib/configs/es2020.js
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * @author Toru Nagashima
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-module.exports = {
- extends: [
- require.resolve("./_base.js"),
- require.resolve("./_override-2015.js"),
- require.resolve("./_override-2016.js"),
- require.resolve("./_override-2017.js"),
- require.resolve("./_override-2018.js"),
- require.resolve("./_override-2019.js"),
- require.resolve("./_override-2020.js"),
- require.resolve("./_override-ts.js"),
- require.resolve("./_override-vue.js"),
- require.resolve("./_override-mocha.js"),
- require.resolve("./_override-special.js"),
- ],
-}
diff --git a/lib/configs/es5.js b/lib/configs/es5.js
index a6ffb64..bd5503d 100644
--- a/lib/configs/es5.js
+++ b/lib/configs/es5.js
@@ -5,11 +5,5 @@
"use strict"
module.exports = {
- extends: [
- require.resolve("./_base.js"),
- require.resolve("./_override-ts.js"),
- require.resolve("./_override-vue.js"),
- require.resolve("./_override-mocha.js"),
- require.resolve("./_override-special.js"),
- ],
+ extends: [require.resolve("./_base.js")],
}
diff --git a/lib/foreign-rules/eslint-comments.js b/lib/foreign-rules/eslint-comments.js
deleted file mode 100644
index 9ebd593..0000000
--- a/lib/foreign-rules/eslint-comments.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * @author Toru Nagashima
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-const { rules, utils } = require("eslint-plugin-eslint-comments")
-
-utils.patch("@mysticatea/eslint-comments/no-unused-disable")
-
-module.exports = Object.keys(rules).reduce((obj, ruleId) => {
- obj[`eslint-comments/${ruleId}`] = rules[ruleId]
- return obj
-}, {})
diff --git a/lib/foreign-rules/eslint-plugin.js b/lib/foreign-rules/eslint-plugin.js
deleted file mode 100644
index fdd64c5..0000000
--- a/lib/foreign-rules/eslint-plugin.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * @author Toru Nagashima
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-const rules = require("eslint-plugin-eslint-plugin").rules
-
-module.exports = Object.keys(rules).reduce((obj, ruleId) => {
- obj[`eslint-plugin/${ruleId}`] = rules[ruleId]
- return obj
-}, {})
diff --git a/lib/foreign-rules/node.js b/lib/foreign-rules/node.js
deleted file mode 100644
index ca57224..0000000
--- a/lib/foreign-rules/node.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * @author Toru Nagashima
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-const rules = require("eslint-plugin-node").rules
-
-module.exports = Object.keys(rules).reduce((obj, ruleId) => {
- obj[`node/${ruleId}`] = rules[ruleId]
- return obj
-}, {})
diff --git a/lib/foreign-rules/prettier.js b/lib/foreign-rules/prettier.js
deleted file mode 100644
index c4334c1..0000000
--- a/lib/foreign-rules/prettier.js
+++ /dev/null
@@ -1,9 +0,0 @@
-/**
- * @author Toru Nagashima
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-const rules = require("eslint-plugin-prettier").rules
-
-module.exports = { prettier: rules.prettier }
diff --git a/lib/foreign-rules/ts.js b/lib/foreign-rules/ts.js
deleted file mode 100644
index 3d4468e..0000000
--- a/lib/foreign-rules/ts.js
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * @author Toru Nagashima
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-// This import requires `typescript` package. The MODULE_NOT_FOUND error should
-// be ignored if people want to lint only JS.
-let rules = null
-try {
- rules = require("@typescript-eslint/eslint-plugin").rules
-} catch (_error) {
- rules = {}
-}
-
-module.exports = Object.keys(rules).reduce((obj, ruleId) => {
- obj[`ts/${ruleId}`] = rules[ruleId]
- return obj
-}, {})
diff --git a/lib/foreign-rules/vue.js b/lib/foreign-rules/vue.js
deleted file mode 100644
index cff2ec3..0000000
--- a/lib/foreign-rules/vue.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * @author Toru Nagashima
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-const rules = require("eslint-plugin-vue").rules
-
-module.exports = Object.keys(rules).reduce((obj, ruleId) => {
- obj[`vue/${ruleId}`] = rules[ruleId]
- return obj
-}, {})
diff --git a/lib/processors.js b/lib/processors.js
deleted file mode 100644
index 480ef61..0000000
--- a/lib/processors.js
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * DON'T EDIT THIS FILE WHICH WAS GENERATED BY './scripts/generate-configs.js'.
- */
-"use strict"
-
-module.exports = {
- ".vue": require("./processors/vue"),
-}
diff --git a/lib/processors/vue.js b/lib/processors/vue.js
deleted file mode 100644
index b6aa629..0000000
--- a/lib/processors/vue.js
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- * This was copied from eslint-plugin-vue.
- * @author Toru Nagashima
- */
-"use strict"
-
-module.exports = {
- preprocess(code) {
- return [code]
- },
-
- postprocess(messages) {
- const state = {
- block: {
- disableAll: false,
- disableRules: new Set(),
- },
- line: {
- disableAll: false,
- disableRules: new Set(),
- },
- }
-
- // Filter messages which are in disabled area.
- return messages[0].filter(message => {
- if (message.ruleId === "@mysticatea/vue/comment-directive") {
- const rules = message.message.split(" ")
- const type = rules.shift()
- const group = rules.shift()
- switch (type) {
- case "--":
- state[group].disableAll = true
- break
- case "++":
- state[group].disableAll = false
- break
- case "-":
- for (const rule of rules) {
- state[group].disableRules.add(rule)
- }
- break
- case "+":
- for (const rule of rules) {
- state[group].disableRules.delete(rule)
- }
- break
- case "clear":
- state.block.disableAll = false
- state.block.disableRules.clear()
- state.line.disableAll = false
- state.line.disableRules.clear()
- break
- // no default
- }
- return false
- }
- return !(
- state.block.disableAll ||
- state.line.disableAll ||
- state.block.disableRules.has(message.ruleId) ||
- state.line.disableRules.has(message.ruleId)
- )
- })
- },
-
- supportsAutofix: true,
-}
diff --git a/lib/rules.js b/lib/rules.js
index 32ec05f..6f7cd0d 100644
--- a/lib/rules.js
+++ b/lib/rules.js
@@ -3,22 +3,14 @@
*/
"use strict"
-module.exports = Object.assign(
- require("./foreign-rules/eslint-comments"),
- require("./foreign-rules/eslint-plugin"),
- require("./foreign-rules/node"),
- require("./foreign-rules/prettier"),
- require("./foreign-rules/ts"),
- require("./foreign-rules/vue"),
- {
- "arrow-parens": require("./rules/arrow-parens"),
- "block-scoped-var": require("./rules/block-scoped-var"),
- "no-instanceof-array": require("./rules/no-instanceof-array"),
- "no-instanceof-wrapper": require("./rules/no-instanceof-wrapper"),
- "no-literal-call": require("./rules/no-literal-call"),
- "no-this-in-static": require("./rules/no-this-in-static"),
- "no-use-ignored-vars": require("./rules/no-use-ignored-vars"),
- "no-useless-rest-spread": require("./rules/no-useless-rest-spread"),
- "prefer-for-of": require("./rules/prefer-for-of"),
- }
-)
+module.exports = {
+ "arrow-parens": require("./rules/arrow-parens"),
+ "block-scoped-var": require("./rules/block-scoped-var"),
+ "no-instanceof-array": require("./rules/no-instanceof-array"),
+ "no-instanceof-wrapper": require("./rules/no-instanceof-wrapper"),
+ "no-literal-call": require("./rules/no-literal-call"),
+ "no-this-in-static": require("./rules/no-this-in-static"),
+ "no-use-ignored-vars": require("./rules/no-use-ignored-vars"),
+ "no-useless-rest-spread": require("./rules/no-useless-rest-spread"),
+ "prefer-for-of": require("./rules/prefer-for-of"),
+}
diff --git a/lib/rules/arrow-parens.js b/lib/rules/arrow-parens.js
index 3736763..d3fb107 100644
--- a/lib/rules/arrow-parens.js
+++ b/lib/rules/arrow-parens.js
@@ -31,7 +31,7 @@ module.exports = {
category: "Stylistic Issues",
recommended: false,
url:
- "https://github.com/mysticatea/eslint-plugin/blob/v13.0.0/docs/rules/arrow-parens.md",
+ "https://github.com/mysticatea/eslint-plugin-core/blob/v13.0.0/docs/rules/arrow-parens.md",
},
fixable: "code",
schema: [],
diff --git a/lib/rules/block-scoped-var.js b/lib/rules/block-scoped-var.js
index b212809..cbbb8d2 100644
--- a/lib/rules/block-scoped-var.js
+++ b/lib/rules/block-scoped-var.js
@@ -197,7 +197,7 @@ module.exports = {
category: "Possible Errors",
recommended: false,
url:
- "https://github.com/mysticatea/eslint-plugin/blob/v13.0.0/docs/rules/block-scoped-var.md",
+ "https://github.com/mysticatea/eslint-plugin-core/blob/v13.0.0/docs/rules/block-scoped-var.md",
},
fixable: null,
schema: [],
diff --git a/lib/rules/no-instanceof-array.js b/lib/rules/no-instanceof-array.js
index 5cc1e54..2d301df 100644
--- a/lib/rules/no-instanceof-array.js
+++ b/lib/rules/no-instanceof-array.js
@@ -15,7 +15,7 @@ module.exports = {
description: "disallow 'instanceof' for Array",
category: "Best Practices",
url:
- "https://github.com/mysticatea/eslint-plugin/blob/v13.0.0/docs/rules/no-instanceof-array.md",
+ "https://github.com/mysticatea/eslint-plugin-core/blob/v13.0.0/docs/rules/no-instanceof-array.md",
},
fixable: "code",
schema: [],
diff --git a/lib/rules/no-instanceof-wrapper.js b/lib/rules/no-instanceof-wrapper.js
index c30ee6b..bb7ae36 100644
--- a/lib/rules/no-instanceof-wrapper.js
+++ b/lib/rules/no-instanceof-wrapper.js
@@ -15,7 +15,7 @@ module.exports = {
description: "disallow 'instanceof' for wrapper objects",
category: "Best Practices",
url:
- "https://github.com/mysticatea/eslint-plugin/blob/v13.0.0/docs/rules/no-instanceof-wrapper.md",
+ "https://github.com/mysticatea/eslint-plugin-core/blob/v13.0.0/docs/rules/no-instanceof-wrapper.md",
},
fixable: "code",
schema: [],
diff --git a/lib/rules/no-literal-call.js b/lib/rules/no-literal-call.js
index 22e6856..fa306cc 100644
--- a/lib/rules/no-literal-call.js
+++ b/lib/rules/no-literal-call.js
@@ -22,7 +22,7 @@ module.exports = {
category: "Possible Errors",
recommended: false,
url:
- "https://github.com/mysticatea/eslint-plugin/blob/v13.0.0/docs/rules/no-literal-call.md",
+ "https://github.com/mysticatea/eslint-plugin-core/blob/v13.0.0/docs/rules/no-literal-call.md",
},
fixable: null,
schema: [],
diff --git a/lib/rules/no-this-in-static.js b/lib/rules/no-this-in-static.js
index a6a342f..73df83f 100644
--- a/lib/rules/no-this-in-static.js
+++ b/lib/rules/no-this-in-static.js
@@ -12,10 +12,11 @@
module.exports = {
meta: {
docs: {
+ version: "es2015",
description: "Disallow `this`/`super` in static methods",
category: "Best Practices",
url:
- "https://github.com/mysticatea/eslint-plugin/blob/v13.0.0/docs/rules/no-this-in-static.md",
+ "https://github.com/mysticatea/eslint-plugin-core/blob/v13.0.0/docs/rules/no-this-in-static.md",
},
fixable: null,
schema: [],
diff --git a/lib/rules/no-use-ignored-vars.js b/lib/rules/no-use-ignored-vars.js
index 5a4855b..7080d05 100644
--- a/lib/rules/no-use-ignored-vars.js
+++ b/lib/rules/no-use-ignored-vars.js
@@ -21,7 +21,7 @@ module.exports = {
category: "Stylistic Issues",
recommended: false,
url:
- "https://github.com/mysticatea/eslint-plugin/blob/v13.0.0/docs/rules/no-use-ignored-vars.md",
+ "https://github.com/mysticatea/eslint-plugin-core/blob/v13.0.0/docs/rules/no-use-ignored-vars.md",
},
fixable: null,
schema: [{ type: "string" }],
diff --git a/lib/rules/no-useless-rest-spread.js b/lib/rules/no-useless-rest-spread.js
index ccca71b..daec32b 100644
--- a/lib/rules/no-useless-rest-spread.js
+++ b/lib/rules/no-useless-rest-spread.js
@@ -94,11 +94,12 @@ function defineFixer(sourceCode, node) {
module.exports = {
meta: {
docs: {
+ version: "es2015",
description: "Disallow unnecessary spread operators.",
category: "Best Practices",
recommended: false,
url:
- "https://github.com/mysticatea/eslint-plugin/blob/v13.0.0/docs/rules/no-useless-rest-spread.md",
+ "https://github.com/mysticatea/eslint-plugin-core/blob/v13.0.0/docs/rules/no-useless-rest-spread.md",
},
fixable: "code",
schema: [],
@@ -130,12 +131,11 @@ module.exports = {
const isRestParameter =
nodeType === "RestElement" && argumentType !== parentType
const type1 = nodeType === "RestElement" ? "rest" : "spread"
- const type2 =
- /*eslint-disable @mysticatea/prettier */
- isRestParameter ? "parameter" :
- isArray ? "element" :
- /* otherwise */ "property"
- /*eslint-enable @mysticatea/prettier */
+ const type2 = isRestParameter
+ ? "parameter"
+ : isArray
+ ? "element"
+ : /* otherwise */ "property"
context.report({
node,
diff --git a/lib/rules/prefer-for-of.js b/lib/rules/prefer-for-of.js
index 37ea4e6..cff35ae 100644
--- a/lib/rules/prefer-for-of.js
+++ b/lib/rules/prefer-for-of.js
@@ -115,7 +115,6 @@ function isTraversingArray(node) {
let indexDecl = null
let lengthDecl = null
- /*eslint-disable @mysticatea/prettier */
return (
init != null &&
init.type === "VariableDeclaration" &&
@@ -131,14 +130,11 @@ function isTraversingArray(node) {
test.operator === "<" &&
test.left.type === "Identifier" &&
test.left.name === indexDecl.id.name &&
- (
- (
- init.declarations.length === 1 &&
- test.right.type === "MemberExpression" &&
- test.right.property.type === "Identifier" &&
- test.right.property.name === "length"
- ) || (
- init.declarations.length === 2 &&
+ ((init.declarations.length === 1 &&
+ test.right.type === "MemberExpression" &&
+ test.right.property.type === "Identifier" &&
+ test.right.property.name === "length") ||
+ (init.declarations.length === 2 &&
(lengthDecl = init.declarations[1]) &&
lengthDecl.id.type === "Identifier" &&
lengthDecl.init != null &&
@@ -146,47 +142,33 @@ function isTraversingArray(node) {
lengthDecl.init.property.type === "Identifier" &&
lengthDecl.init.property.name === "length" &&
test.right.type === "Identifier" &&
- test.right.name === lengthDecl.id.name
- )
- ) &&
+ test.right.name === lengthDecl.id.name)) &&
update != null &&
- (
- (
- update.type === "UpdateExpression" &&
- update.operator === "++" &&
- update.argument.type === "Identifier" &&
- update.argument.name === indexDecl.id.name
- ) || (
- update.type === "AssignmentExpression" &&
+ ((update.type === "UpdateExpression" &&
+ update.operator === "++" &&
+ update.argument.type === "Identifier" &&
+ update.argument.name === indexDecl.id.name) ||
+ (update.type === "AssignmentExpression" &&
update.operator === "+=" &&
update.left.type === "Identifier" &&
update.left.name === indexDecl.id.name &&
update.right.type === "Literal" &&
- update.right.value === 1
- ) || (
- update.type === "AssignmentExpression" &&
+ update.right.value === 1) ||
+ (update.type === "AssignmentExpression" &&
update.operator === "=" &&
update.left.type === "Identifier" &&
update.left.name === indexDecl.id.name &&
update.right.type === "BinaryExpression" &&
update.right.operator === "+" &&
- (
- (
- update.right.left.type === "Identifier" &&
- update.right.left.name === indexDecl.id.name &&
- update.right.right.type === "Literal" &&
- update.right.right.value === 1
- ) || (
- update.right.left.type === "Literal" &&
+ ((update.right.left.type === "Identifier" &&
+ update.right.left.name === indexDecl.id.name &&
+ update.right.right.type === "Literal" &&
+ update.right.right.value === 1) ||
+ (update.right.left.type === "Literal" &&
update.right.left.value === 1 &&
update.right.right.type === "Identifier" &&
- update.right.right.name === indexDecl.id.name
- )
- )
- )
- )
+ update.right.right.name === indexDecl.id.name))))
)
- /*eslint-enable @mysticatea/prettier */
}
/**
@@ -229,13 +211,13 @@ function isAssignee(startNode) {
}
/**
- * Checks whether the all references of the index variable are used to get
+ * Checks whether all references of the index variable are used to get
* array elements.
*
* @param {RuleContext} context - The rule context object.
* @param {ASTNode} node - The `for` loop node which is a simple array
* traversing.
- * @returns {boolean} `true` if the the all references of the index variable are
+ * @returns {boolean} `true` if all references of the index variable are
* used to get array elements.
*/
function isIndexVarOnlyUsedToGetArrayElements(context, node) {
@@ -494,11 +476,12 @@ function fixForStatement(context, node, fixer) {
module.exports = {
meta: {
docs: {
+ version: "es2015",
description: "requires for-of statements instead of Array#forEach",
category: "Best Practices",
recommended: false,
url:
- "https://github.com/mysticatea/eslint-plugin/blob/v13.0.0/docs/rules/prefer-for-of.md",
+ "https://github.com/mysticatea/eslint-plugin-core/blob/v13.0.0/docs/rules/prefer-for-of.md",
},
fixable: "code",
schema: [],
diff --git a/lib/utils.js b/lib/utils.js
deleted file mode 100644
index 8d3d9fb..0000000
--- a/lib/utils.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * @author Toru Nagashima
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-const fs = require("fs")
-const path = require("path")
-let configuredRulesDocumentUrl = null
-
-/**
- * Get the base URL from a given repository information.
- * @param {string|{type:string,url:string}} repository The repository information.
- * @returns {string|null} The base URL.
- */
-function getBaseUrl(repository) {
- if (typeof repository === "string") {
- return `https://github.com/${repository}`
- }
- if (
- repository &&
- typeof repository.url === "string" &&
- /^git\+.+\.git$/u.test(repository.url)
- ) {
- return repository.url.slice(4, -4)
- }
-
- return null
-}
-
-module.exports = {
- /**
- * The URL of rule's documentation for the `+eslint-plugin` config.
- * @type {string}
- */
- get rulesDocumentUrl() {
- if (configuredRulesDocumentUrl) {
- return configuredRulesDocumentUrl
- }
- try {
- const { version, repository } = JSON.parse(
- fs.readFileSync(
- path.join(process.cwd(), "package.json"),
- "utf8"
- )
- )
- const baseUrl = getBaseUrl(repository)
- if (baseUrl) {
- return `${baseUrl}/blob/v${version}/docs/rules/{{name}}.md`
- }
- } catch (_error) {
- // ignore
- }
- return undefined
- },
-
- set rulesDocumentUrl(value) {
- configuredRulesDocumentUrl = value
- },
-}
diff --git a/package.json b/package.json
index 65aad32..9ae4605 100644
--- a/package.json
+++ b/package.json
@@ -1,48 +1,36 @@
{
- "name": "@mysticatea/eslint-plugin",
+ "name": "@mysticatea/eslint-plugin-core",
"version": "13.0.0",
"description": "Additional ESLint rules.",
"engines": {
- "node": ">=8.10.0"
+ "node": ">=10.0.0"
},
"main": "index.js",
"files": [
"lib"
],
"peerDependencies": {
- "eslint": ">=6.6.0"
- },
- "dependencies": {
- "@typescript-eslint/eslint-plugin": "~2.6.1",
- "@typescript-eslint/parser": "~2.6.1",
- "eslint-plugin-eslint-comments": "~3.1.2",
- "eslint-plugin-eslint-plugin": "~2.1.0",
- "eslint-plugin-node": "~10.0.0",
- "eslint-plugin-prettier": "~3.1.1",
- "eslint-plugin-vue": "~6.0.0",
- "prettier": "~1.19.1",
- "vue-eslint-parser": "^7.0.0"
+ "eslint": ">=6.8.0"
},
+ "dependencies": {},
"devDependencies": {
- "@mysticatea/eslint-plugin": "file:.",
- "codecov": "^3.6.1",
- "eslint": "~6.6.0",
- "fs-extra": "^8.1.0",
- "globals": "^12.1.1",
- "mocha": "^6.2.2",
+ "@mysticatea/eslint-plugin": "^13.0.0",
+ "codecov": "^3.6.5",
+ "eslint": "^7.0.0",
+ "mocha": "^7.1.2",
"npm-run-all": "^4.1.5",
- "nyc": "^14.1.1",
+ "nyc": "^15.0.1",
"opener": "^1.5.1",
- "rimraf": "^3.0.0",
- "typescript": "~3.7.2"
+ "rimraf": "^3.0.2",
+ "typescript": "^3.9.2"
},
"scripts": {
"clean": "rimraf .nyc_output coverage",
"coverage": "opener coverage/lcov-report/index.html",
"codecov": "codecov --disable=gcov -t $CODECOV_TOKEN",
- "lint": "eslint lib scripts tests",
+ "lint": "eslint .",
"test": "npm run -s lint && nyc mocha \"tests/lib/**/*.js\" --reporter dot",
- "update": "node scripts/generate-browser-globals && node scripts/generate-configs && node scripts/generate-rules",
+ "update": "node scripts/generate-configs && node scripts/generate-rules",
"preversion": "run-s clean update test",
"version": "eslint lib/rules --fix && git add lib",
"postversion": "git push && git push --tags",
@@ -50,7 +38,7 @@
},
"repository": {
"type": "git",
- "url": "git+https://github.com/mysticatea/eslint-plugin.git"
+ "url": "git+https://github.com/mysticatea/eslint-plugin-core.git"
},
"keywords": [
"eslint",
@@ -66,9 +54,12 @@
"ignore"
],
"author": "Toru Nagashima",
+ "contributors": [
+ "Brett Zamir"
+ ],
"license": "MIT",
"bugs": {
- "url": "https://github.com/mysticatea/eslint-plugin/issues"
+ "url": "https://github.com/mysticatea/eslint-plugin-core/issues"
},
- "homepage": "https://github.com/mysticatea/eslint-plugin#readme"
+ "homepage": "https://github.com/mysticatea/eslint-plugin-core#readme"
}
diff --git a/scripts/generate-browser-globals.js b/scripts/generate-browser-globals.js
deleted file mode 100644
index 7b3bcfe..0000000
--- a/scripts/generate-browser-globals.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * @author Toru Nagashima
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-const fs = require("fs")
-const path = require("path")
-const { CLIEngine } = require("eslint")
-const { browser: originalGlobals } = require("globals")
-
-const targetFile = path.resolve(__dirname, "../lib/configs/_browser-globals.js")
-const globals = {}
-const allows = new Set([
- "atob",
- "btoa",
- "cancelAnimationFrame",
- "document",
- "fetch",
- "indexedDB",
- "localStorage",
- "location",
- "matchMedia",
- "navigator",
- "requestAnimationFrame",
- "sessionStorage",
- "window",
-])
-
-for (const key of Object.keys(originalGlobals).sort()) {
- if (key[0] === key[0].toUpperCase() || allows.has(key)) {
- globals[key] = originalGlobals[key] ? "writable" : "readonly"
- }
-}
-
-const linter = new CLIEngine({ fix: true })
-const rawCode = `/**
-* DON'T EDIT THIS FILE WHICH WAS GENERATED BY './scripts/generate-browser-globals.js'.
-*/
-"use strict"
-
-module.exports = ${JSON.stringify(globals, null, 4)}
-`
-const code =
- linter.executeOnText(rawCode, "_browser-globals.js").results[0].output ||
- rawCode
-
-fs.writeFileSync(targetFile, code)
diff --git a/scripts/generate-rules.js b/scripts/generate-rules.js
index 141e876..21950d8 100644
--- a/scripts/generate-rules.js
+++ b/scripts/generate-rules.js
@@ -17,20 +17,13 @@ fs.writeFileSync(
*/
"use strict"
-module.exports = Object.assign(
-${fs
- .readdirSync(path.resolve(__dirname, "../lib/foreign-rules"))
- .map(fileName => path.basename(fileName, ".js"))
- .map(id => ` require("./foreign-rules/${id}"),`)
- .join("\n")}
- {
+module.exports = {
${fs
.readdirSync(path.resolve(__dirname, "../lib/rules"))
.map(fileName => path.basename(fileName, ".js"))
.map(id => ` "${id}": require("./rules/${id}"),`)
.join("\n")}
}
-)
`
)
diff --git a/tests/lib/configs/_rules.js b/tests/lib/configs/_rules.js
index 170f2cb..2bfeb18 100644
--- a/tests/lib/configs/_rules.js
+++ b/tests/lib/configs/_rules.js
@@ -9,7 +9,7 @@ const {
ConfigArrayFactory,
} = require("eslint/lib/cli-engine/config-array-factory")
const Validator = require("eslint/lib/shared/config-validator")
-const { rules: PluginRulesIndex } = require("@mysticatea/eslint-plugin")
+const { rules: PluginRulesIndex } = require("../../../")
const coreRules = new Linter().getRules()
const pluginRules = new Map(
@@ -82,7 +82,7 @@ module.exports = {
/**
* Get the plugin rules.
- * @param {"eslint-comments"|"node"|"ts"|"vue"} pluginName The plugin name to get.
+ * @param {"node"|"ts"} pluginName The plugin name to get.
* @returns {object} The core rules. Keys are rule IDs and values are each rule definition.
*/
getPluginRuleNames(pluginName) {
diff --git a/tests/lib/configs/browser.js b/tests/lib/configs/browser.js
deleted file mode 100644
index d37e11b..0000000
--- a/tests/lib/configs/browser.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * @author Toru Nagashima
- * @copyright 2016 Toru Nagashima. All rights reserved.
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-const Rules = require("./_rules")
-
-describe("'+browser.js'", () => {
- const config = require("../../../lib/configs/+browser")
-
- it("should be a valid config.", () => {
- Rules.validateConfig(config, "+browser.js")
- })
-})
diff --git a/tests/lib/configs/es2015.js b/tests/lib/configs/es2015.js
index fe430b2..a7721d6 100644
--- a/tests/lib/configs/es2015.js
+++ b/tests/lib/configs/es2015.js
@@ -16,15 +16,15 @@ const Rules = require("./_rules")
*/
function isES6Rule(ruleId) {
const def = Rules.getRuleDefinition(ruleId)
- const category = def && def.meta && def.meta.docs && def.meta.docs.category
+ const version = def && def.meta && def.meta.docs && def.meta.docs.version
- return category === "ECMAScript 6"
+ return version === "es2015"
}
describe("'es2015.js'", () => {
const config = require("../../../lib/configs/es2015")
const configuredRules = Rules.getRulesOfConfig(config, "es2015")
- const existingRules = Rules.getCoreRuleNames()
+ const existingRules = Rules.getPluginRuleNames("mysticatea")
it("should be a valid config.", () => {
Rules.validateConfig(config, "es2015.js")
diff --git a/tests/lib/configs/es2016.js b/tests/lib/configs/es2016.js
deleted file mode 100644
index 77dc687..0000000
--- a/tests/lib/configs/es2016.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * @author Toru Nagashima
- * @copyright 2016 Toru Nagashima. All rights reserved.
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-const Rules = require("./_rules")
-
-describe("'es2016.js'", () => {
- const config = require("../../../lib/configs/es2016")
-
- it("should be a valid config.", () => {
- Rules.validateConfig(config, "es2016.js")
- })
-})
diff --git a/tests/lib/configs/es2017.js b/tests/lib/configs/es2017.js
deleted file mode 100644
index 5101b53..0000000
--- a/tests/lib/configs/es2017.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * @author Toru Nagashima
- * @copyright 2016 Toru Nagashima. All rights reserved.
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-const Rules = require("./_rules")
-
-describe("'es2017.js'", () => {
- const config = require("../../../lib/configs/es2017")
-
- it("should be a valid config.", () => {
- Rules.validateConfig(config, "es2017.js")
- })
-})
diff --git a/tests/lib/configs/es2018.js b/tests/lib/configs/es2018.js
deleted file mode 100644
index deccfd0..0000000
--- a/tests/lib/configs/es2018.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * @author Toru Nagashima
- * @copyright 2016 Toru Nagashima. All rights reserved.
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-const Rules = require("./_rules")
-
-describe("'es2018.js'", () => {
- const config = require("../../../lib/configs/es2018")
-
- it("should be a valid config.", () => {
- Rules.validateConfig(config, "es2018.js")
- })
-})
diff --git a/tests/lib/configs/es2019.js b/tests/lib/configs/es2019.js
deleted file mode 100644
index 31e1420..0000000
--- a/tests/lib/configs/es2019.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/**
- * @author Toru Nagashima
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-const Rules = require("./_rules")
-
-describe("'es2019.js'", () => {
- const config = require("../../../lib/configs/es2019")
-
- it("should be a valid config.", () => {
- Rules.validateConfig(config, "es2019.js")
- })
-})
diff --git a/tests/lib/configs/es2020.js b/tests/lib/configs/es2020.js
deleted file mode 100644
index cb1611a..0000000
--- a/tests/lib/configs/es2020.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/**
- * @author Toru Nagashima
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-const Rules = require("./_rules")
-
-describe("'es2020.js'", () => {
- const config = require("../../../lib/configs/es2020")
-
- it("should be a valid config.", () => {
- Rules.validateConfig(config, "es2020.js")
- })
-})
diff --git a/tests/lib/configs/es5.js b/tests/lib/configs/es5.js
index 63caafd..1f4bde2 100644
--- a/tests/lib/configs/es5.js
+++ b/tests/lib/configs/es5.js
@@ -16,20 +16,15 @@ const Rules = require("./_rules")
*/
function isES6Rule(ruleId) {
const def = Rules.getRuleDefinition(ruleId)
- const category = def && def.meta && def.meta.docs && def.meta.docs.category
+ const version = def && def.meta && def.meta.docs && def.meta.docs.version
- return category === "ECMAScript 6"
+ return version === "es2015"
}
describe("'es5.js'", () => {
const config = require("../../../lib/configs/es5")
const configuredRules = Rules.getRulesOfConfig(config, "es5")
- const existingRules = [].concat(
- Rules.getCoreRuleNames(),
- Rules.getPluginRuleNames("mysticatea"),
- Rules.getPluginRuleNames("eslint-comments"),
- Rules.getPluginRuleNames("prettier")
- )
+ const existingRules = Rules.getPluginRuleNames("mysticatea")
it("should be a valid config.", () => {
Rules.validateConfig(config, "es5.js")
diff --git a/tests/lib/configs/eslint-plugin.js b/tests/lib/configs/eslint-plugin.js
deleted file mode 100644
index 7576c68..0000000
--- a/tests/lib/configs/eslint-plugin.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * @author Toru Nagashima
- * @copyright 2016 Toru Nagashima. All rights reserved.
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-const assert = require("assert")
-const Rules = require("./_rules")
-
-describe("'+eslint-plugin.js'", () => {
- const config = require("../../../lib/configs/+eslint-plugin")
- const configuredRules = Rules.getRulesOfConfig(config, "+eslint-plugin")
- const existingRules = Rules.getPluginRuleNames("eslint-plugin")
-
- it("should be a valid config.", () => {
- Rules.validateConfig(config, "+eslint-plugin.js")
- })
-
- for (const ruleId of existingRules) {
- it(`should include existing rule '${ruleId}'.`, () => {
- assert(ruleId in configuredRules)
- })
- }
-})
diff --git a/tests/lib/configs/mocha.js b/tests/lib/configs/mocha.js
deleted file mode 100644
index 8b12408..0000000
--- a/tests/lib/configs/mocha.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * @author Toru Nagashima
- * @copyright 2016 Toru Nagashima. All rights reserved.
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-const Rules = require("./_rules")
-
-describe("'mocha.js'", () => {
- const config = require("../../../lib/configs/_override-mocha")
-
- it("should be a valid config.", () => {
- Rules.validateConfig(config, "mocha.js")
- })
-})
diff --git a/tests/lib/configs/modules.js b/tests/lib/configs/modules.js
deleted file mode 100644
index 343f9fc..0000000
--- a/tests/lib/configs/modules.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * @author Toru Nagashima
- * @copyright 2016 Toru Nagashima. All rights reserved.
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-const Rules = require("./_rules")
-
-describe("'+modules.js'", () => {
- const config = require("../../../lib/configs/+modules")
-
- it("should be a valid config.", () => {
- Rules.validateConfig(config, "+modules.js")
- })
-})
diff --git a/tests/lib/configs/node.js b/tests/lib/configs/node.js
deleted file mode 100644
index 7077389..0000000
--- a/tests/lib/configs/node.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * @author Toru Nagashima
- * @copyright 2016 Toru Nagashima. All rights reserved.
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-const assert = require("assert")
-const Rules = require("./_rules")
-
-describe("'+node.js'", () => {
- const config = require("../../../lib/configs/+node")
- const configuredRules = Rules.getRulesOfConfig(config, "+node")
- const existingRules = Rules.getPluginRuleNames("node")
-
- it("should be a valid config.", () => {
- Rules.validateConfig(config, "+node.js")
- })
-
- for (const ruleId of existingRules) {
- it(`should include existing rule '${ruleId}'.`, () => {
- assert(ruleId in configuredRules)
- })
- }
-})
diff --git a/tests/lib/configs/special.js b/tests/lib/configs/special.js
deleted file mode 100644
index c0de8de..0000000
--- a/tests/lib/configs/special.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * @author Toru Nagashima
- * @copyright 2016 Toru Nagashima. All rights reserved.
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-const Rules = require("./_rules")
-
-describe("'special.js'", () => {
- const config = require("../../../lib/configs/_override-special")
-
- it("should be a valid config.", () => {
- Rules.validateConfig(config, "special.js")
- })
-})
diff --git a/tests/lib/configs/ts.js b/tests/lib/configs/ts.js
deleted file mode 100644
index e671575..0000000
--- a/tests/lib/configs/ts.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * @author Toru Nagashima
- * @copyright 2016 Toru Nagashima. All rights reserved.
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-const assert = require("assert")
-const Rules = require("./_rules")
-
-describe("'ts.js'", () => {
- const config = require("../../../lib/configs/_override-ts")
- const configuredRules = Rules.getRulesOfConfig(config, "_override-ts")
- const existingRules = Rules.getPluginRuleNames("ts")
-
- it("should be a valid config.", () => {
- Rules.validateConfig(config, "ts.js")
- })
-
- for (const ruleId of existingRules) {
- it(`should include existing rule '${ruleId}'.`, () => {
- assert(ruleId in configuredRules)
- })
- }
-})
diff --git a/tests/lib/configs/vue.js b/tests/lib/configs/vue.js
deleted file mode 100644
index 83541fd..0000000
--- a/tests/lib/configs/vue.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * @author Toru Nagashima
- * @copyright 2016 Toru Nagashima. All rights reserved.
- * See LICENSE file in root directory for full license.
- */
-"use strict"
-
-const assert = require("assert")
-const Rules = require("./_rules")
-
-describe("'vue.js'", () => {
- const config = require("../../../lib/configs/_override-vue")
- const configuredRules = Rules.getRulesOfConfig(config, "_override-ts")
- const existingRules = Rules.getPluginRuleNames("vue")
-
- it("should be a valid config.", () => {
- Rules.validateConfig(config, "vue.js")
- })
-
- for (const ruleId of existingRules) {
- it(`should include existing rule '${ruleId}'.`, () => {
- assert(ruleId in configuredRules)
- })
- }
-})
diff --git a/tests/lib/rules/no-instanceof-array.js b/tests/lib/rules/no-instanceof-array.js
index c046fd3..1c041db 100644
--- a/tests/lib/rules/no-instanceof-array.js
+++ b/tests/lib/rules/no-instanceof-array.js
@@ -20,6 +20,7 @@ const tester = new RuleTester()
tester.run("no-instanceof-array", rule, {
valid: [
+ "var Array = 5",
"Array",
"Array.isArray(x)",
"function foo(Array) { x instanceof Array }",