diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index ac50f1aa..00000000 --- a/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules/** -build/** diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 3f779460..00000000 --- a/.eslintrc.json +++ /dev/null @@ -1,225 +0,0 @@ -{ - "extends": [ - "plugin:node/recommended", - "plugin:eslint-comments/recommended", - "plugin:eslint-plugin/all", - "plugin:unicorn/recommended" - ], - - "env": { - "node": true - }, - - "parserOptions": { - "sourceType": "script", - "ecmaVersion": "latest" - }, - - "plugins": ["node", "eslint-plugin"], - - "rules": { - "array-bracket-spacing": ["error", "never"], - "block-spacing": ["error", "always"], - "brace-style": ["error", "1tbs"], - "camelcase": ["error", { "properties": "always" }], - "comma-dangle": ["error", "never"], - "comma-spacing": ["error", { "before": false, "after": true }], - "comma-style": ["error", "last"], - "complexity": ["error", 10], - "computed-property-spacing": ["error", "never"], - "consistent-return": "error", - "consistent-this": ["error", "self"], - "curly": ["error", "multi-line"], - "default-case": "error", - "dot-location": ["error", "property"], - "dot-notation": "error", - "eol-last": "error", - "eqeqeq": "error", - "func-call-spacing": "error", - "func-style": ["error", "declaration"], - "guard-for-in": "error", - "indent": ["error", 4, { "SwitchCase": 1, "VariableDeclarator": 1 }], - "key-spacing": ["error", { "beforeColon": false, "afterColon": true }], - "keyword-spacing": ["error", { "before": true, "after": true }], - "linebreak-style": ["error", "unix"], - "lines-around-comment": [ - "error", - { - "beforeBlockComment": false, - "afterBlockComment": false, - "beforeLineComment": true, - "afterLineComment": false, - "allowBlockStart": true, - "allowBlockEnd": true, - "allowObjectStart": true, - "allowObjectEnd": true, - "allowArrayStart": true, - "allowArrayEnd": true - } - ], - "max-depth": ["error", 5], - "new-cap": ["error", { "newIsCap": true, "capIsNew": true }], - "new-parens": "error", - "no-array-constructor": "error", - "no-caller": "error", - "no-catch-shadow": "error", - "no-cond-assign": ["error", "except-parens"], - "no-console": "error", - "no-const-assign": "error", - "no-constant-condition": "error", - "no-control-regex": "error", - "no-debugger": "error", - "no-delete-var": "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-eval": "error", - "no-ex-assign": "error", - "no-extend-native": "error", - "no-extra-boolean-cast": "error", - "no-extra-parens": "error", - "no-extra-semi": "error", - "no-fallthrough": "error", - "no-floating-decimal": "error", - "no-func-assign": "error", - "no-implied-eval": "error", - "no-invalid-regexp": "error", - "no-irregular-whitespace": "error", - "no-labels": "error", - "no-lone-blocks": "error", - "no-lonely-if": "error", - "no-loop-func": "error", - "no-mixed-requires": "error", - "no-mixed-spaces-and-tabs": "error", - "no-multi-spaces": ["error", { "ignoreEOLComments": true }], - "no-multi-str": "error", - "no-multiple-empty-lines": "error", - "no-unsafe-negation": "error", - "no-nested-ternary": "error", - "no-new-func": "error", - "no-new-object": "error", - "no-new-require": "error", - "no-new-wrappers": "error", - "no-octal": "error", - "no-octal-escape": "error", - "no-path-concat": "error", - "no-process-exit": "error", - "no-redeclare": "error", - "no-return-assign": "error", - "no-regex-spaces": "error", - "no-self-assign": "error", - "no-self-compare": "error", - "no-sequences": "error", - "no-sparse-arrays": "error", - "no-template-curly-in-string": "error", - "no-throw-literal": "error", - "no-trailing-spaces": "error", - "no-undef": "error", - "no-undefined": "error", - "no-underscore-dangle": "error", - "no-unexpected-multiline": "error", - "no-unmodified-loop-condition": "error", - "no-unneeded-ternary": "error", - "no-unreachable": "error", - "no-unsafe-finally": "error", - "no-unused-expressions": "error", - "no-unused-vars": "error", - "no-use-before-define": "error", - "no-useless-call": "error", - "no-useless-concat": "error", - "no-useless-escape": "error", - "no-useless-return": "error", - "no-var": "error", - "no-warning-comments": "error", - "no-whitespace-before-property": "error", - "no-with": "error", - "object-curly-newline": ["error", { "consistent": true }], - "object-curly-spacing": ["error", "always"], - "object-property-newline": "error", - "operator-assignment": ["error", "always"], - "operator-linebreak": ["error", "after"], - "padded-blocks": ["error", "never"], - "prefer-const": "error", - "prefer-template": "error", - "quote-props": ["error", "consistent"], - "quotes": ["error", "double"], - "radix": "error", - "semi": ["error", "always"], - "semi-spacing": ["error", { "before": false, "after": true }], - "space-before-blocks": ["error", "always"], - "space-before-function-paren": ["error", { "anonymous": "always", "named": "never" }], - "space-in-parens": ["error", "never"], - "space-infix-ops": "error", - "space-unary-ops": ["error", { "words": true, "nonwords": false }], - "spaced-comment": ["error", "always", { "exceptions": ["-"] }], - "strict": ["error", "global"], - "template-curly-spacing": ["error", "never"], - "use-isnan": "error", - "valid-jsdoc": ["error", { - "prefer": { - "return": "returns" - } - }], - "valid-typeof": "error", - "wrap-iife": "error", - "yoda": ["error", "never"], - - // eslint-plugin-eslint-plugin - "eslint-plugin/meta-property-ordering": ["error", [ - "type", "docs", "fixable", "messages", "schema", "deprecated", "replacedBy" - ]], - "eslint-plugin/require-meta-docs-url": ["error", { - "pattern": "https://github.com/platinumazure/eslint-plugin-qunit/blob/master/docs/rules/{{name}}.md" - }], - - // eslint-plugin-node - "node/no-missing-require": ["error", { - "allowModules": ["@typescript-eslint/parser"] - }], - - // eslint-plugin-unicorn - "unicorn/consistent-function-scoping": "off", - "unicorn/empty-brace-spaces": "off", - "unicorn/filename-case": "off", - "unicorn/no-array-reduce": "off", - "unicorn/no-null": "off", - "unicorn/prefer-at": "off", // TODO: enable once we raise Node requirement to v16.6.0 - "unicorn/prefer-module": "off", - "unicorn/prevent-abbreviations": "off" - }, - - "overrides": [ - { - "files": ["**/*.md"], - "processor": "markdown/markdown" - }, - { - "files": ["**/*.md/*.js", "**/*.md/*.javascript"], - "plugins": ["markdown"], - "parserOptions": { - "sourceType": "module" - }, - "rules": { - "brace-style": "off", - "eqeqeq": "off", - "guard-for-in": "off", - "no-constant-condition": "off", - "no-empty-function": "off", - "no-undef": "off", - "no-unused-expressions": "off", - "no-unused-vars": "off", - "no-var": "off", - "quotes": "off", - "space-before-function-paren": "off" - } - }, - { - "files": ["tests/**/*.js"], - "extends": ["plugin:mocha/recommended"] - } - ] -} diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 00000000..2e763a21 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,248 @@ +"use strict"; + +const js = require("@eslint/js"); +const { FlatCompat } = require("@eslint/eslintrc"); +const eslintPluginMarkdown = require("eslint-plugin-markdown"); +const eslintPluginEslintPluginAll = require("eslint-plugin-eslint-plugin/configs/all"); +const globals = require("globals"); + +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended +}); + +module.exports = [ + ...compat.extends( + "plugin:node/recommended", + "plugin:eslint-comments/recommended", + "plugin:unicorn/recommended" + ), + + eslintPluginEslintPluginAll, + + // Apply mocha config only to tests. + ...compat.extends("plugin:mocha/recommended").map(config => ({ ...config, + files: ["tests/**/*.js"] })), + + { + languageOptions: { + "sourceType": "script", + "ecmaVersion": "latest", + "globals": globals.node + } + }, + { + "rules": + { + "array-bracket-spacing": ["error", "never"], + "block-spacing": ["error", "always"], + "brace-style": ["error", "1tbs"], + "camelcase": ["error", { "properties": "always" }], + "comma-dangle": ["error", "never"], + "comma-spacing": ["error", { "before": false, + "after": true }], + "comma-style": ["error", "last"], + "complexity": ["error", 10], + "computed-property-spacing": ["error", "never"], + "consistent-return": "error", + "consistent-this": ["error", "self"], + "curly": ["error", "multi-line"], + "default-case": "error", + "dot-location": ["error", "property"], + "dot-notation": "error", + "eol-last": "error", + "eqeqeq": "error", + "func-call-spacing": "error", + "func-style": ["error", "declaration"], + "guard-for-in": "error", + "indent": ["error", 4, { "SwitchCase": 1, + "VariableDeclarator": 1 }], + "key-spacing": ["error", { "beforeColon": false, + "afterColon": true }], + "keyword-spacing": ["error", { "before": true, + "after": true }], + "linebreak-style": ["error", "unix"], + "lines-around-comment": [ + "error", + { + "beforeBlockComment": false, + "afterBlockComment": false, + "beforeLineComment": true, + "afterLineComment": false, + "allowBlockStart": true, + "allowBlockEnd": true, + "allowObjectStart": true, + "allowObjectEnd": true, + "allowArrayStart": true, + "allowArrayEnd": true + } + ], + "max-depth": ["error", 5], + "new-cap": ["error", { "newIsCap": true, + "capIsNew": true }], + "new-parens": "error", + "no-array-constructor": "error", + "no-caller": "error", + "no-catch-shadow": "error", + "no-cond-assign": ["error", "except-parens"], + "no-console": "error", + "no-const-assign": "error", + "no-constant-condition": "error", + "no-control-regex": "error", + "no-debugger": "error", + "no-delete-var": "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-eval": "error", + "no-ex-assign": "error", + "no-extend-native": "error", + "no-extra-boolean-cast": "error", + "no-extra-parens": "error", + "no-extra-semi": "error", + "no-fallthrough": "error", + "no-floating-decimal": "error", + "no-func-assign": "error", + "no-implied-eval": "error", + "no-invalid-regexp": "error", + "no-irregular-whitespace": "error", + "no-labels": "error", + "no-lone-blocks": "error", + "no-lonely-if": "error", + "no-loop-func": "error", + "no-mixed-requires": "error", + "no-mixed-spaces-and-tabs": "error", + "no-multi-spaces": ["error", { "ignoreEOLComments": true }], + "no-multi-str": "error", + "no-multiple-empty-lines": "error", + "no-unsafe-negation": "error", + "no-nested-ternary": "error", + "no-new-func": "error", + "no-new-object": "error", + "no-new-require": "error", + "no-new-wrappers": "error", + "no-octal": "error", + "no-octal-escape": "error", + "no-path-concat": "error", + "no-process-exit": "error", + "no-redeclare": "error", + "no-return-assign": "error", + "no-regex-spaces": "error", + "no-self-assign": "error", + "no-self-compare": "error", + "no-sequences": "error", + "no-sparse-arrays": "error", + "no-template-curly-in-string": "error", + "no-throw-literal": "error", + "no-trailing-spaces": "error", + "no-undef": "error", + "no-undefined": "error", + "no-underscore-dangle": "error", + "no-unexpected-multiline": "error", + "no-unmodified-loop-condition": "error", + "no-unneeded-ternary": "error", + "no-unreachable": "error", + "no-unsafe-finally": "error", + "no-unused-expressions": "error", + "no-unused-vars": "error", + "no-use-before-define": "error", + "no-useless-call": "error", + "no-useless-concat": "error", + "no-useless-escape": "error", + "no-useless-return": "error", + "no-var": "error", + "no-warning-comments": "error", + "no-whitespace-before-property": "error", + "no-with": "error", + "object-curly-newline": ["error", { "consistent": true }], + "object-curly-spacing": ["error", "always"], + "object-property-newline": "error", + "operator-assignment": ["error", "always"], + "operator-linebreak": ["error", "after"], + "padded-blocks": ["error", "never"], + "prefer-const": "error", + "prefer-template": "error", + "quote-props": ["error", "consistent"], + "quotes": ["error", "double"], + "radix": "error", + "semi": ["error", "always"], + "semi-spacing": ["error", { "before": false, + "after": true }], + "space-before-blocks": ["error", "always"], + "space-before-function-paren": ["error", { "anonymous": "always", + "named": "never" }], + "space-in-parens": ["error", "never"], + "space-infix-ops": "error", + "space-unary-ops": ["error", { "words": true, + "nonwords": false }], + "spaced-comment": ["error", "always", { "exceptions": ["-"] }], + "strict": ["error", "global"], + "template-curly-spacing": ["error", "never"], + "use-isnan": "error", + "valid-jsdoc": ["error", { + "prefer": { + "return": "returns" + } + }], + "valid-typeof": "error", + "wrap-iife": "error", + "yoda": ["error", "never"], + + // eslint-plugin-eslint-plugin + "eslint-plugin/meta-property-ordering": ["error", [ + "type", "docs", "fixable", "messages", "schema", "deprecated", "replacedBy" + ]], + "eslint-plugin/require-meta-docs-url": ["error", { + "pattern": "https://github.com/platinumazure/eslint-plugin-qunit/blob/master/docs/rules/{{name}}.md" + }], + + // eslint-plugin-node + "node/no-missing-require": ["error", { + "allowModules": ["@typescript-eslint/parser"] + }], + + // eslint-plugin-unicorn + "unicorn/consistent-function-scoping": "off", + "unicorn/empty-brace-spaces": "off", + "unicorn/filename-case": "off", + "unicorn/no-array-reduce": "off", + "unicorn/no-null": "off", + // eslint-disable-next-line no-warning-comments + "unicorn/prefer-at": "off", // TODO: enable once we raise Node requirement to v16.6.0 + "unicorn/prefer-module": "off", + "unicorn/prevent-abbreviations": "off" + } + }, + { + files: ["**/*.md"], + plugins: { markdown: eslintPluginMarkdown }, + processor: "markdown/markdown" + }, + { + "files": ["**/*.md/*.js", "**/*.md/*.javascript"], + "languageOptions": { + "parserOptions": { + "sourceType": "module" + } + }, + "rules": { + "brace-style": "off", + "eqeqeq": "off", + "guard-for-in": "off", + "no-constant-condition": "off", + "no-empty-function": "off", + "no-undef": "off", + "no-unused-expressions": "off", + "no-unused-vars": "off", + "no-var": "off", + "quotes": "off", + "space-before-function-paren": "off", + "strict": "off" + } + } +]; + diff --git a/package-lock.json b/package-lock.json index 2ba9ebe6..da659227 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,12 +13,14 @@ "requireindex": "^1.2.0" }, "devDependencies": { + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "^8.55.0", "@release-it/conventional-changelog": "^7.0.2", "@typescript-eslint/parser": "^6.7.4", "all-contributors-cli": "^6.26.1", "chai": "^4.3.10", "coveralls": "^3.1.1", - "eslint": "^8.51.0", + "eslint": "^8.55.0", "eslint-doc-generator": "^1.5.1", "eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-eslint-plugin": "^5.1.1", @@ -28,6 +30,7 @@ "eslint-plugin-qunit": "file:./", "eslint-plugin-unicorn": "^49.0.0", "eslint-remote-tester": "^3.0.1", + "globals": "^13.23.0", "markdownlint-cli": "^0.37.0", "mocha": "^10.2.0", "mocha-lcov-reporter": "^1.3.0", @@ -585,9 +588,9 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.2.tgz", - "integrity": "sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", @@ -623,9 +626,9 @@ } }, "node_modules/@eslint/js": { - "version": "8.52.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.52.0.tgz", - "integrity": "sha512-mjZVbpaeMZludF2fsWLD0Z9gCref1Tk4i9+wddjRvpUNqqcndPkBD09N/Mapey0b3jaXbLm2kICwFv2E64QinA==", + "version": "8.55.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.55.0.tgz", + "integrity": "sha512-qQfo2mxH5yVom1kacMtZZJFVdW+E70mqHMJvVg6WTLo+VBuQJ4TojZlfWBjK0ve5BdEeNAVxOsl/nvNMpJOaJA==", "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } @@ -1501,9 +1504,9 @@ "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==" }, "node_modules/acorn": { - "version": "8.9.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.9.0.tgz", - "integrity": "sha512-jaVNAFBHNLXspO543WnNNPZFRtavh3skAkITqD0/2aeMkKZTN+254PyhwxFYrk3vQ1xfY+2wbesJMs/JC8/PwQ==", + "version": "8.11.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", + "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", "bin": { "acorn": "bin/acorn" }, @@ -3644,14 +3647,14 @@ } }, "node_modules/eslint": { - "version": "8.52.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.52.0.tgz", - "integrity": "sha512-zh/JHnaixqHZsolRB/w9/02akBk9EPrOs9JwcTP2ek7yL5bVvXuRariiaAjjoJ5DvuwQ1WAE/HsMz+w17YgBCg==", + "version": "8.55.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.55.0.tgz", + "integrity": "sha512-iyUUAM0PCKj5QpwGfmCAG9XXbZCWsqP/eWAWrG/W0umvjuLRBECwSFdt+rCntju0xEH7teIABPwXpahftIaTdA==", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.2", - "@eslint/js": "8.52.0", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.55.0", "@humanwhocodes/config-array": "^0.11.13", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", diff --git a/package.json b/package.json index 48c7d2c0..68f03466 100644 --- a/package.json +++ b/package.json @@ -26,12 +26,14 @@ "requireindex": "^1.2.0" }, "devDependencies": { + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "^8.55.0", "@release-it/conventional-changelog": "^7.0.2", "@typescript-eslint/parser": "^6.7.4", "all-contributors-cli": "^6.26.1", "chai": "^4.3.10", "coveralls": "^3.1.1", - "eslint": "^8.51.0", + "eslint": "^8.55.0", "eslint-doc-generator": "^1.5.1", "eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-eslint-plugin": "^5.1.1", @@ -41,6 +43,7 @@ "eslint-plugin-qunit": "file:./", "eslint-plugin-unicorn": "^49.0.0", "eslint-remote-tester": "^3.0.1", + "globals": "^13.23.0", "markdownlint-cli": "^0.37.0", "mocha": "^10.2.0", "mocha-lcov-reporter": "^1.3.0", @@ -72,6 +75,7 @@ "exclude": [ "build/**", "eslint-remote-tester.config.js", + "eslint.config.js", "scripts/**", "tests/**" ], diff --git a/tests/.eslintrc b/tests/.eslintrc deleted file mode 100644 index 8a30ebae..00000000 --- a/tests/.eslintrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "env": { - "node": true, - "mocha": true - } -}