@anolilab/eslint-config 11.2.2 → 11.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/dist/config/plugins/vitest.js +3 -2
- package/dist/config/plugins/vitest.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +14 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
## @anolilab/eslint-config [11.3.0](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/eslint-config@11.2.3...@anolilab/eslint-config@11.3.0) (2023-08-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* updated eslint-config to include eslint-plugin-vitest-globals ([5752b1f](https://github.com/anolilab/javascript-style-guide/commit/5752b1f2addbc7e8d91798212e4d501c74f6e791))
|
|
7
|
+
|
|
8
|
+
## @anolilab/eslint-config [11.2.3](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/eslint-config@11.2.2...@anolilab/eslint-config@11.2.3) (2023-08-10)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* upgrade project dependencies to latest versions ([340ff87](https://github.com/anolilab/javascript-style-guide/commit/340ff87dfe01ca4c7a21536c26c6dd703afc62f7))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Miscellaneous Chores
|
|
17
|
+
|
|
18
|
+
* **deps:** update dependency eslint-plugin-cypress to ^2.14.0 ([#727](https://github.com/anolilab/javascript-style-guide/issues/727)) ([75296ea](https://github.com/anolilab/javascript-style-guide/commit/75296eaeb1a271597a7d309c5ae7ba52cb3b7889))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Dependencies
|
|
23
|
+
|
|
24
|
+
* **@anolilab/package-json-utils:** upgraded to 3.0.4
|
|
25
|
+
* **@anolilab/semantic-release-preset:** upgraded to 6.0.4
|
|
26
|
+
|
|
1
27
|
## @anolilab/eslint-config [11.2.2](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/eslint-config@11.2.1...@anolilab/eslint-config@11.2.2) (2023-08-08)
|
|
2
28
|
|
|
3
29
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('../../chunk-MFE6DF6Y.js');
|
|
4
|
+
var packageJsonUtils = require('@anolilab/package-json-utils');
|
|
4
5
|
|
|
5
|
-
var t=
|
|
6
|
+
global.hasAnolilabEsLintVitestGlobalsPlugin||(global.hasAnolilabEsLintVitestGlobalsPlugin=packageJsonUtils.hasDependency("eslint-plugin-vitest-globals")||packageJsonUtils.hasDevDependency("eslint-plugin-vitest-globals"));var t=["plugin:vitest/recommended","plugin:vitest/all"];global.hasAnolilabEsLintVitestGlobalsPlugin&&t.push("plugin:vitest-globals/recommended");var i={overrides:[{extends:t,files:["**/__tests__/**/*.?(c|m)[jt]s?(x)","**/?(*.){test,spec}.?(c|m)[jt]s?(x)"],plugins:["vitest"],rules:{"vitest/max-expects":"off","vitest/no-hooks":"off","vitest/no-mocks-import":"off","vitest/no-restricted-vi-methods":"off","vitest/no-standalone-expect":"error","vitest/valid-expect":["error",{alwaysAwait:!0,maxArgs:2,minArgs:1}]}}]},o=i;
|
|
6
7
|
|
|
7
|
-
module.exports =
|
|
8
|
+
module.exports = o;
|
|
8
9
|
//# sourceMappingURL=out.js.map
|
|
9
10
|
//# sourceMappingURL=vitest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/config/plugins/vitest.ts"],"names":["config","vitest_default"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/config/plugins/vitest.ts"],"names":["hasDependency","hasDevDependency","plugins","config","vitest_default"],"mappings":"gCACA,OAAS,iBAAAA,EAAe,oBAAAC,MAAwB,+BAE3C,OAAO,uCACR,OAAO,qCAAuCD,EAAc,8BAA8B,GAAKC,EAAiB,8BAA8B,GAGlJ,IAAMC,EAAU,CAAC,4BAA6B,mBAAmB,EAE7D,OAAO,sCACPA,EAAQ,KAAK,mCAAmC,EAGpD,IAAMC,EAAwB,CAC1B,UAAW,CACP,CACI,QAASD,EACT,MAAO,CAAC,oCAAqC,qCAAqC,EAClF,QAAS,CAAC,QAAQ,EAElB,MAAO,CAIH,qBAAsB,MAItB,kBAAmB,MAInB,yBAA0B,MAI1B,kCAAmC,MAInC,8BAA+B,QAI/B,sBAAuB,CAAC,QAAS,CAAE,YAAa,GAAM,QAAS,EAAG,QAAS,CAAE,CAAC,CAClF,CACJ,CACJ,CACJ,EAEOE,EAAQD","sourcesContent":["import type { Linter } from \"eslint\";\nimport { hasDependency, hasDevDependency } from \"@anolilab/package-json-utils\";\n\nif (!global.hasAnolilabEsLintVitestGlobalsPlugin) {\n global.hasAnolilabEsLintVitestGlobalsPlugin = hasDependency(\"eslint-plugin-vitest-globals\") || hasDevDependency(\"eslint-plugin-vitest-globals\");\n}\n\nconst plugins = [\"plugin:vitest/recommended\", \"plugin:vitest/all\"];\n\nif (global.hasAnolilabEsLintVitestGlobalsPlugin) {\n plugins.push(\"plugin:vitest-globals/recommended\");\n}\n\nconst config: Linter.Config = {\n overrides: [\n {\n extends: plugins,\n files: [\"**/__tests__/**/*.?(c|m)[jt]s?(x)\", \"**/?(*.){test,spec}.?(c|m)[jt]s?(x)\"],\n plugins: [\"vitest\"],\n // TODO: transform all rules to error\n rules: {\n // Enforce a maximum number of expect per test\n // https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/max-expects.md\n // This rule should be set on the root config\n \"vitest/max-expects\": \"off\",\n\n // Enforce valid expect() usage\n // https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-hooks.md\n \"vitest/no-hooks\": \"off\",\n\n // Disallow setup and teardown hooks\n // https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-mocks-import.md\n \"vitest/no-mocks-import\": \"off\",\n\n // Disallow importing from mocks directory\n // https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-restricted-vi-methods.md\n \"vitest/no-restricted-vi-methods\": \"off\",\n\n // Disallow specific vi. methods\n // https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-standalone-expect.md\n \"vitest/no-standalone-expect\": \"error\",\n\n // Disallow using expect outside of it or test blocks\n // https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/valid-expect.md\n \"vitest/valid-expect\": [\"error\", { alwaysAwait: true, maxArgs: 2, minArgs: 1 }],\n },\n },\n ],\n};\n\nexport default config;\n"]}
|
package/dist/index.js
CHANGED
|
@@ -14,13 +14,13 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
14
14
|
var x__default = /*#__PURE__*/_interopDefault(x);
|
|
15
15
|
var k__default = /*#__PURE__*/_interopDefault(k);
|
|
16
16
|
|
|
17
|
-
var R=["best-practices","errors","style","es6","variables"],c=["compat","eslint-comments","import","promise","simple-import-sort","no-extend-native","node","no-secrets","sonarjs","security","regexp","jsonc","markdown","toml","yml","html","antfu","unicorn","es","perfectionist"],E=[{configName:"array-func",dependencies:["eslint-plugin-array-func"]},{configName:"jsdoc",dependencies:["eslint-plugin-jsdoc"]},{configName:"tsdoc",dependencies:["eslint-plugin-tsdoc","typescript"]},{configName:"lodash",dependencies:["lodash","eslint-plugin-lodash"]},{configName:"lodash-fp",dependencies:["lodash","eslint-plugin-lodash-fp"]},{configName:"you-dont-need-lodash-underscore",dependencies:["lodash","eslint-plugin-you-dont-need-lodash-underscore"]},{configName:"mdx",dependencies:["eslint-plugin-mdx"],oneOfDependency:["nextra","docz","@docusaurus/core","gatsby-plugin-mdx"],resolve:["@mdx-js/mdx","remark-mdx","@mdx-js/loader","@mdx-js/rollup","@mdx-js/react"]},{configName:"no-unsanitized",dependencies:["eslint-plugin-no-unsanitized"]},{configName:"react",dependencies:["react","react-dom","eslint-plugin-react"]},{configName:"react-redux",dependencies:["eslint-plugin-react-redux"],oneOfDependency:["@reduxjs/toolkit","redux"]},{configName:"jsx-a11y",dependencies:["react","react-dom","eslint-plugin-jsx-a11y"]},{configName:"react-hooks",dependencies:["react","react-dom","eslint-plugin-react-hooks"]},{configName:"react-usememo",dependencies:["react","react-dom","@arthurgeron/eslint-plugin-react-usememo"]},{configName:"you-dont-need-momentjs",dependencies:["moment","eslint-plugin-you-dont-need-momentjs"]},{configName:"you-dont-need-momentjs",dependencies:["moment-timezone","eslint-plugin-you-dont-need-momentjs"]},{configName:"tailwindcss",dependencies:["eslint-plugin-tailwindcss"]},{configName:"cypress",dependencies:["cypress","eslint-plugin-cypress"]},{configName:"jest",dependencies:["jest","eslint-plugin-jest"]},{configName:"jest-dom",dependencies:["jest","@testing-library/jest-dom","eslint-plugin-jest-dom"]},{configName:"jest-async",dependencies:["jest","eslint-plugin-jest-async"]},{configName:"jest-formatting",dependencies:["jest","eslint-plugin-jest-formatting"]},{configName:"tailwindcss",dependencies:["tailwindcss"]},{configName:"testing-library-dom",dependencies:["@testing-library/dom","eslint-plugin-testing-library"]},{configName:"testing-library-react",dependencies:["react","@testing-library/react","eslint-plugin-testing-library"]},{configName:"typescript",dependencies:["typescript"],files:["tsconfig.json","tsconfig.eslint.json"]},{configName:"etc",dependencies:["typescript","eslint-plugin-etc"]},{configName:"vitest",dependencies:["vitest","eslint-plugin-vitest"]},{configName:"zod",dependencies:["zod","eslint-plugin-zod"]},{configName:"ava",dependencies:["ava","eslint-plugin-ava"]},{configName:"editorconfig",dependencies:["eslint-plugin-editorconfig"],files:[".editorconfig"]},{configName:"storybook",dependencies:["storybook","eslint-plugin-storybook"]},{configName:"playwright",dependencies:["playwright","eslint-plugin-playwright"]},{configName:"tanstack-query",dependencies:["@tanstack/react-query","@tanstack/eslint-plugin-query"]}],p=[...c],t={};p.length===c.length&&E.forEach(s=>{let{configName:e,dependencies:i}=s;if(chunkOCCLNRZC_js.a.plugin?.[e]!==!1){let a=[];if(i.forEach(n=>{(packageJsonUtils.hasDependency(n)||packageJsonUtils.hasDevDependency(n))&&a.push(n);}),t[e]={},a.length===0){if(s.oneOfDependency!==void 0){let n=!1;s.oneOfDependency.forEach(r=>{!n&&(packageJsonUtils.hasDependency(r)||packageJsonUtils.hasDevDependency(r))&&(n=!0,t[e][r]=!0);});}s.resolve!==void 0&&s.resolve.forEach(n=>{packageJsonUtils.resolvePackage(n)!==void 0&&(t[e][n]=!0);}),s.files!==void 0&&s.files.forEach(n=>{packageJsonUtils.hasFile(n)&&(t[e][n]=!0);});}a.length===i.length?(delete t[e],p.push(e)):i.forEach(n=>{t[e][n]=packageJsonUtils.hasDependency(n)||packageJsonUtils.hasDevDependency(n);});}});var m=R,b=p,h=t;var O={"n/prefer-global/text-decoder":{"11.0.0":"off"},"n/prefer-global/text-encoder":{"11.0.0":"off"},"n/prefer-global/url":{"10.0.0":"off"},"n/prefer-global/url-search-params":{"10.0.0":"off"},"n/prefer-promises/dns":{"11.14.0":"off"},"n/prefer-promises/fs":{"11.14.0":"off"},"no-useless-catch":{"10.0.0":"off"},"prefer-destructuring":{"6.0.0":"off"},"prefer-named-capture-group":{"10.0.0":"off"},"prefer-object-spread":{"8.3.0":"off"},"prefer-rest-params":{"6.0.0":"off"},"promise/prefer-await-to-then":{"7.6.0":"off"},"unicorn/no-new-buffer":{"5.10.0":"off"},"unicorn/prefer-flat-map":{"11.0.0":"off"},"unicorn/prefer-spread":{"5.0.0":"off"}},y=O;if(!global.hasAnolilabEsLintConfigLoaded){process.env.DEBUG&&(chunkSEYYGHPU_js.b(`
|
|
17
|
+
var R=["best-practices","errors","style","es6","variables"],c=["compat","eslint-comments","import","promise","simple-import-sort","no-extend-native","node","no-secrets","sonarjs","security","regexp","jsonc","markdown","toml","yml","html","antfu","unicorn","es","perfectionist"],E=[{configName:"array-func",dependencies:["eslint-plugin-array-func"]},{configName:"jsdoc",dependencies:["eslint-plugin-jsdoc"]},{configName:"tsdoc",dependencies:["eslint-plugin-tsdoc","typescript"]},{configName:"lodash",dependencies:["lodash","eslint-plugin-lodash"]},{configName:"lodash-fp",dependencies:["lodash","eslint-plugin-lodash-fp"]},{configName:"you-dont-need-lodash-underscore",dependencies:["lodash","eslint-plugin-you-dont-need-lodash-underscore"]},{configName:"mdx",dependencies:["eslint-plugin-mdx"],oneOfDependency:["nextra","docz","@docusaurus/core","gatsby-plugin-mdx"],resolve:["@mdx-js/mdx","remark-mdx","@mdx-js/loader","@mdx-js/rollup","@mdx-js/react"]},{configName:"no-unsanitized",dependencies:["eslint-plugin-no-unsanitized"]},{configName:"react",dependencies:["react","react-dom","eslint-plugin-react"]},{configName:"react-redux",dependencies:["eslint-plugin-react-redux"],oneOfDependency:["@reduxjs/toolkit","redux"]},{configName:"jsx-a11y",dependencies:["react","react-dom","eslint-plugin-jsx-a11y"]},{configName:"react-hooks",dependencies:["react","react-dom","eslint-plugin-react-hooks"]},{configName:"react-usememo",dependencies:["react","react-dom","@arthurgeron/eslint-plugin-react-usememo"]},{configName:"you-dont-need-momentjs",dependencies:["moment","eslint-plugin-you-dont-need-momentjs"]},{configName:"you-dont-need-momentjs",dependencies:["moment-timezone","eslint-plugin-you-dont-need-momentjs"]},{configName:"tailwindcss",dependencies:["eslint-plugin-tailwindcss"]},{configName:"cypress",dependencies:["cypress","eslint-plugin-cypress"]},{configName:"jest",dependencies:["jest","eslint-plugin-jest"]},{configName:"jest-dom",dependencies:["jest","@testing-library/jest-dom","eslint-plugin-jest-dom"]},{configName:"jest-async",dependencies:["jest","eslint-plugin-jest-async"]},{configName:"jest-formatting",dependencies:["jest","eslint-plugin-jest-formatting"]},{configName:"tailwindcss",dependencies:["tailwindcss"]},{configName:"testing-library-dom",dependencies:["@testing-library/dom","eslint-plugin-testing-library"]},{configName:"testing-library-react",dependencies:["react","@testing-library/react","eslint-plugin-testing-library"]},{configName:"typescript",dependencies:["typescript"],files:["tsconfig.json","tsconfig.eslint.json"]},{configName:"etc",dependencies:["typescript","eslint-plugin-etc"]},{configName:"vitest",dependencies:["vitest","eslint-plugin-vitest","eslint-plugin-vitest-globals"]},{configName:"zod",dependencies:["zod","eslint-plugin-zod"]},{configName:"ava",dependencies:["ava","eslint-plugin-ava"]},{configName:"editorconfig",dependencies:["eslint-plugin-editorconfig"],files:[".editorconfig"]},{configName:"storybook",dependencies:["storybook","eslint-plugin-storybook"]},{configName:"playwright",dependencies:["playwright","eslint-plugin-playwright"]},{configName:"tanstack-query",dependencies:["@tanstack/react-query","@tanstack/eslint-plugin-query"]}],p=[...c],t={};p.length===c.length&&E.forEach(s=>{let{configName:e,dependencies:i}=s;if(chunkOCCLNRZC_js.a.plugin?.[e]!==!1){let a=[];if(i.forEach(n=>{(packageJsonUtils.hasDependency(n)||packageJsonUtils.hasDevDependency(n))&&a.push(n);}),t[e]={},a.length===0){if(s.oneOfDependency!==void 0){let n=!1;s.oneOfDependency.forEach(r=>{!n&&(packageJsonUtils.hasDependency(r)||packageJsonUtils.hasDevDependency(r))&&(n=!0,t[e][r]=!0);});}s.resolve!==void 0&&s.resolve.forEach(n=>{packageJsonUtils.resolvePackage(n)!==void 0&&(t[e][n]=!0);}),s.files!==void 0&&s.files.forEach(n=>{packageJsonUtils.hasFile(n)&&(t[e][n]=!0);});}a.length===i.length?(delete t[e],p.push(e)):i.forEach(n=>{t[e][n]=packageJsonUtils.hasDependency(n)||packageJsonUtils.hasDevDependency(n);});}});var m=R,b=p,h=t;var O={"n/prefer-global/text-decoder":{"11.0.0":"off"},"n/prefer-global/text-encoder":{"11.0.0":"off"},"n/prefer-global/url":{"10.0.0":"off"},"n/prefer-global/url-search-params":{"10.0.0":"off"},"n/prefer-promises/dns":{"11.14.0":"off"},"n/prefer-promises/fs":{"11.14.0":"off"},"no-useless-catch":{"10.0.0":"off"},"prefer-destructuring":{"6.0.0":"off"},"prefer-named-capture-group":{"10.0.0":"off"},"prefer-object-spread":{"8.3.0":"off"},"prefer-rest-params":{"6.0.0":"off"},"promise/prefer-await-to-then":{"7.6.0":"off"},"unicorn/no-new-buffer":{"5.10.0":"off"},"unicorn/prefer-flat-map":{"11.0.0":"off"},"unicorn/prefer-spread":{"5.0.0":"off"}},y=O;if(!global.hasAnolilabEsLintConfigLoaded){process.env.DEBUG&&(chunkSEYYGHPU_js.b(`
|
|
18
18
|
@anolilab/eslint-config loaded the following plugins:
|
|
19
19
|
`),chunkSEYYGHPU_js.b(" @rushstack/eslint-plugin-security"),c.map(e=>e==="import"?"i":e==="node"?"n":e).forEach(e=>chunkSEYYGHPU_js.a(e)));let s=!1;Object.entries(h).forEach(([e,i])=>{Object.values(i).some(Boolean)&&(s=!0,chunkSEYYGHPU_js.b(`
|
|
20
20
|
Your package.json container dependencies for the "${e}" eslint-plugin, please add the following dependencies with your chosen package manager to enable this plugin:`),Object.entries(i).forEach(([n,r])=>{r||chunkSEYYGHPU_js.b(` ${n}`);}));}),s&&(chunkSEYYGHPU_js.b(`
|
|
21
21
|
To disable this message, add the following to your package.json:`),chunkSEYYGHPU_js.b(` "anolilab": { "eslint-config": { plugin: { "plugin-name": false } } }
|
|
22
|
-
`)),chunkSEYYGHPU_js.b('To disable all logging, add the following to your eslint command call "NO_LOGS=true eslint ..."'),global.hasAnolilabEsLintConfigLoaded=!0;}var
|
|
23
|
-
Found prettier as dependency, disabling some rules to fix wrong behavior of the rule with eslint and prettier`));var C={extends:[...m.map(s=>path.join(__dirname,`./config/${s}.js`)),...b.map(s=>path.join(__dirname,`./config/plugins/${s}.js`))],globals:{...x__default.default.browser,...x__default.default.nodeBuiltin},ignorePatterns:["!.*",".git/","node_modules/","bower_components/","jspm_packages/",".npm/","lib-cov/","coverage/",".nyc_output/",".cache/","build/","dist/","tmp/","**/*.min.*","*.d.ts","pnpm-lock.yaml"],overrides:[{files:["**/migrations/*.{js,ts}"],rules:{"filenames/match-regex":"off"}},{files:["**/*.spec.{js,ts,tsx}","**/*.test.{js,ts,tsx}","**/__mocks__/*.{js,ts,tsx}","**/__tests__/*.{js,ts,tsx}","**/test/*.{js,ts,tsx}"],rules:{"no-magic-numbers":"off","sonarjs/no-duplicate-string":"off"}},{files:packageJsonUtils.packageIsTypeModule?["*.js","*.mjs"]:["*.mjs"],parser:"@babel/eslint-parser",parserOptions:{babelOptions:{plugins:["@babel/plugin-syntax-import-assertions"]},requireConfigFile:!1}}],parser:"",rules:{...
|
|
22
|
+
`)),chunkSEYYGHPU_js.b('To disable all logging, add the following to your eslint command call "NO_LOGS=true eslint ..."'),global.hasAnolilabEsLintConfigLoaded=!0;}var v={},g;packageJsonUtils.pkg?.engines?.node&&(g=packageJsonUtils.pkg.engines.node);Object.entries(y).forEach(([s,e])=>{Object.keys(e).sort(k__default.default.rcompare).forEach(i=>{g&&k__default.default.intersects(g,`<${i}`)&&(v[s]=e[i]);});});!global.hasAnolilabEsLintConfigPrettier&&(packageJsonUtils.hasDependency("prettier")||packageJsonUtils.hasDevDependency("prettier"))&&(global.hasAnolilabEsLintConfigPrettier=!0,chunkOCCLNRZC_js.a.info_on_disabling_prettier_conflict_rule!==!1&&chunkSEYYGHPU_js.b(`
|
|
23
|
+
Found prettier as dependency, disabling some rules to fix wrong behavior of the rule with eslint and prettier`));var C={extends:[...m.map(s=>path.join(__dirname,`./config/${s}.js`)),...b.map(s=>path.join(__dirname,`./config/plugins/${s}.js`))],globals:{...x__default.default.browser,...x__default.default.nodeBuiltin},ignorePatterns:["!.*",".git/","node_modules/","bower_components/","jspm_packages/",".npm/","lib-cov/","coverage/",".nyc_output/",".cache/","build/","dist/","tmp/","**/*.min.*","*.d.ts","pnpm-lock.yaml"],overrides:[{files:["**/migrations/*.{js,ts}"],rules:{"filenames/match-regex":"off"}},{files:["**/*.spec.{js,ts,tsx}","**/*.test.{js,ts,tsx}","**/__mocks__/*.{js,ts,tsx}","**/__tests__/*.{js,ts,tsx}","**/test/*.{js,ts,tsx}"],rules:{"no-magic-numbers":"off","sonarjs/no-duplicate-string":"off"}},{files:packageJsonUtils.packageIsTypeModule?["*.js","*.mjs"]:["*.mjs"],parser:"@babel/eslint-parser",parserOptions:{babelOptions:{plugins:["@babel/plugin-syntax-import-assertions"]},requireConfigFile:!1}}],parser:"",rules:{...v}},H=C;
|
|
24
24
|
|
|
25
25
|
module.exports = H;
|
|
26
26
|
//# sourceMappingURL=out.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/config.ts","../src/engine-node-overwrite.ts"],"names":["hasDependency","hasDevDependency","packageIsTypeModule","pkg","globals","join","semver","hasFile","resolvePackage","baseConfig","internalPluginConfig","pluginConfig","loadedPlugins","possiblePlugins","plugin","configName","dependencies","eslint_config_default","foundDependencies","dependency","foundOneOfDependency","rdependency","file","rules","pluginRules","possiblePluginRules","engineRules","engine_node_overwrite_default","consoleLog","name","consolePlugin","hasLogged","installed","configRules","nodeVersion","rule","ruleConfig","minVersion","config","src_default"],"mappings":"mHAYA,MAAO,mDAEP,OAAS,iBAAAA,EAAe,oBAAAC,EAAkB,uBAAAC,EAAqB,OAAAC,MAAW,+BAE1E,OAAOC,MAAa,UACpB,OAAS,QAAAC,MAAY,OACrB,OAAOC,MAAY,SClBnB,OAAS,iBAAAN,EAAe,oBAAAC,EAAkB,WAAAM,EAAS,kBAAAC,MAAsB,+BAKzE,IAAMC,EAAa,CAAC,iBAAkB,SAAU,QAAS,MAAO,WAAW,EAG9DC,EAAuB,CAChC,SACA,kBACA,SACA,UACA,qBACA,mBACA,OAEA,aACA,UACA,WACA,SAEA,QACA,WACA,OACA,MACA,OAGA,QACA,UACA,KACA,eACJ,EAEMC,EAA6B,CAC/B,CACI,WAAY,aACZ,aAAc,CAAC,0BAA0B,CAC7C,EACA,CACI,WAAY,QACZ,aAAc,CAAC,qBAAqB,CACxC,EACA,CACI,WAAY,QACZ,aAAc,CAAC,sBAAuB,YAAY,CACtD,EACA,CACI,WAAY,SACZ,aAAc,CAAC,SAAU,sBAAsB,CACnD,EACA,CACI,WAAY,YACZ,aAAc,CAAC,SAAU,yBAAyB,CACtD,EACA,CACI,WAAY,kCAC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,CACI,MAAO,CAAC,yBAAyB,EACjC,MAAO,CACH,wBAAyB,KAC7B,CACJ,EACA,CACI,MAAO,CAEH,wBACA,wBAGA,6BACA,6BAGA,uBACJ,EACA,MAAO,CACH,mBAAoB,MACpB,8BAA+B,KACnC,CACJ,EAEA,CACI,MAAOF,EAAsB,CAAC,OAAQ,OAAO,EAAI,CAAC,OAAO,EACzD,OAAQ,uBACR,cAAe,CACX,aAAc,CACV,QAAS,CAAC,wCAAwC,CACtD,EACA,kBAAmB,EACvB,CACJ,CACJ,EAEA,OAAQ,GAER,MAAO,CACH,GAAG+B,CACP,CACJ,EAEOM,EAAQD","sourcesContent":["/**\n * rushstack eslint-patch is used to include plugins as dev\n * dependencies instead of imposing them as peer dependencies\n *\n * {@link https://www.npmjs.com/package/@rushstack/eslint-patch}\n * {@link https://stackoverflow.com/a/74478635/1392749}\n * {@link https://github.com/eslint/eslint/issues/3458}\n * {@link https://eslint.org/blog/2022/08/new-config-system-part-1/}\n * {@link https://eslint.org/blog/2022/08/new-config-system-part-2/}\n * {@link https://eslint.org/blog/2022/08/new-config-system-part-3/}\n * {@link https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new}\n */\nimport \"@rushstack/eslint-patch/modern-module-resolution\";\n\nimport { hasDependency, hasDevDependency, packageIsTypeModule, pkg } from \"@anolilab/package-json-utils\";\nimport type { Linter } from \"eslint\";\nimport globals from \"globals\";\nimport { join } from \"node:path\";\nimport semver from \"semver\";\n\nimport { internalPluginConfig, pluginRules, possiblePluginRules, rules } from \"./config\";\nimport engineRules from \"./engine-node-overwrite\";\nimport anolilabEslintConfig from \"./utils/eslint-config\";\nimport { consoleLog, consolePlugin } from \"./utils/loggers\";\n\n// Workaround VS Code trying to run this file twice!\nif (!global.hasAnolilabEsLintConfigLoaded) {\n if (process.env[\"DEBUG\"]) {\n consoleLog(\"\\n@anolilab/eslint-config loaded the following plugins:\\n\");\n\n consoleLog(\" @rushstack/eslint-plugin-security\");\n internalPluginConfig\n .map((name: string) => {\n if (name === \"import\") {\n return \"i\";\n }\n\n if (name === \"node\") {\n return \"n\";\n }\n\n return name;\n })\n .forEach((plugin) => consolePlugin(plugin));\n }\n\n let hasLogged = false;\n\n Object.entries(possiblePluginRules).forEach(([plugin, dependencies]) => {\n const hasOneDependency = Object.values(dependencies).some(Boolean);\n\n if (hasOneDependency) {\n hasLogged = true;\n\n consoleLog(\n `\\nYour package.json container dependencies for the \"${plugin}\" eslint-plugin, please add the following dependencies with your chosen package manager to enable this plugin:`,\n );\n\n Object.entries(dependencies).forEach(([dependency, installed]) => {\n if (!installed) {\n consoleLog(` ${dependency}`);\n }\n });\n }\n });\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (hasLogged) {\n consoleLog(\"\\nTo disable this message, add the following to your package.json:\");\n consoleLog(' \"anolilab\": { \"eslint-config\": { plugin: { \"plugin-name\": false } } }\\n');\n }\n\n consoleLog('To disable all logging, add the following to your eslint command call \"NO_LOGS=true eslint ...\"');\n\n global.hasAnolilabEsLintConfigLoaded = true;\n}\n\nconst configRules: Linter.RulesRecord = {};\nlet nodeVersion: string | undefined;\n\nif (pkg?.engines?.[\"node\"]) {\n nodeVersion = pkg.engines[\"node\"];\n}\n\nObject.entries(engineRules).forEach(([rule, ruleConfig]) => {\n Object.keys(ruleConfig)\n .sort(semver.rcompare)\n .forEach((minVersion) => {\n if (nodeVersion && semver.intersects(nodeVersion, `<${minVersion}`)) {\n // eslint-disable-next-line security/detect-object-injection\n configRules[rule] = ruleConfig[minVersion as keyof typeof ruleConfig] as Linter.RuleEntry;\n }\n });\n});\n\n// Workaround VS Code trying to run this file twice!\nif (!global.hasAnolilabEsLintConfigPrettier && (hasDependency(\"prettier\") || hasDevDependency(\"prettier\"))) {\n global.hasAnolilabEsLintConfigPrettier = true;\n\n if (anolilabEslintConfig[\"info_on_disabling_prettier_conflict_rule\"] !== false) {\n consoleLog(\"\\nFound prettier as dependency, disabling some rules to fix wrong behavior of the rule with eslint and prettier\");\n }\n}\n\nconst config: Linter.Config = {\n // After an .eslintrc.js file is loaded, ESLint will normally continue visiting all parent folders\n // to look for other .eslintrc.js files, and also consult a personal file ~/.eslintrc.js. If any files\n // are found, their options will be merged. This is difficult for humans to understand, and it will cause\n // nondeterministic behavior if files are loaded from outside the Git working folder.\n //\n // Setting root=true causes ESLint to stop looking for other config files after the first .eslintrc.js\n extends: [\n ...rules.map((plugin) => join(__dirname, `./config/${plugin}.js`)),\n\n ...pluginRules.map((plugin) => join(__dirname, `./config/plugins/${plugin}.js`)),\n ],\n globals: {\n ...globals.browser,\n ...globals.nodeBuiltin,\n },\n ignorePatterns: [\n \"!.*\",\n\n \".git/\",\n \"node_modules/\",\n \"bower_components/\",\n \"jspm_packages/\",\n \".npm/\",\n\n \"lib-cov/\",\n \"coverage/\",\n \".nyc_output/\",\n \".cache/\",\n\n \"build/\",\n \"dist/\",\n \"tmp/\",\n\n \"**/*.min.*\",\n\n // Manually authored .d.ts files are generally used to describe external APIs that are not expected\n // to follow our coding conventions. Linting those files tends to produce a lot of spurious suppressions,\n // so we simply ignore them.\n \"*.d.ts\",\n\n \"pnpm-lock.yaml\",\n ],\n overrides: [\n {\n files: [\"**/migrations/*.{js,ts}\"],\n rules: {\n \"filenames/match-regex\": \"off\",\n },\n },\n {\n files: [\n // Test files\n \"**/*.spec.{js,ts,tsx}\",\n \"**/*.test.{js,ts,tsx}\",\n\n // Facebook convention\n \"**/__mocks__/*.{js,ts,tsx}\",\n \"**/__tests__/*.{js,ts,tsx}\",\n\n // Microsoft convention\n \"**/test/*.{js,ts,tsx}\",\n ],\n rules: {\n \"no-magic-numbers\": \"off\",\n \"sonarjs/no-duplicate-string\": \"off\",\n },\n },\n // Fixes https://github.com/eslint/eslint/discussions/15305\n {\n files: packageIsTypeModule ? [\"*.js\", \"*.mjs\"] : [\"*.mjs\"],\n parser: \"@babel/eslint-parser\",\n parserOptions: {\n babelOptions: {\n plugins: [\"@babel/plugin-syntax-import-assertions\"],\n },\n requireConfigFile: false,\n },\n },\n ],\n // Disable the parser by default\n parser: \"\",\n // is loaded.\n rules: {\n ...configRules,\n },\n};\n\nexport default config;\n","import { hasDependency, hasDevDependency, hasFile, resolvePackage } from \"@anolilab/package-json-utils\";\n\nimport type { PackageRules } from \"./types\";\nimport anolilabEslintConfig from \"./utils/eslint-config\";\n\nconst baseConfig = [\"best-practices\", \"errors\", \"style\", \"es6\", \"variables\"];\n\n// eslint-disable-next-line import/exports-last\nexport const internalPluginConfig = [\n \"compat\",\n \"eslint-comments\",\n \"import\",\n \"promise\",\n \"simple-import-sort\",\n \"no-extend-native\",\n \"node\",\n // Security Rules\n \"no-secrets\",\n \"sonarjs\",\n \"security\",\n \"regexp\",\n // file rules\n \"jsonc\",\n \"markdown\",\n \"toml\",\n \"yml\",\n \"html\",\n\n // custom rules\n \"antfu\",\n \"unicorn\",\n \"es\",\n \"perfectionist\",\n];\n\nconst pluginConfig: PackageRules = [\n {\n configName: \"array-func\",\n dependencies: [\"eslint-plugin-array-func\"],\n },\n {\n configName: \"jsdoc\",\n dependencies: [\"eslint-plugin-jsdoc\"],\n },\n {\n configName: \"tsdoc\",\n dependencies: [\"eslint-plugin-tsdoc\", \"typescript\"],\n },\n {\n configName: \"lodash\",\n dependencies: [\"lodash\", \"eslint-plugin-lodash\"],\n },\n {\n configName: \"lodash-fp\",\n dependencies: [\"lodash\", \"eslint-plugin-lodash-fp\"],\n },\n {\n configName: \"you-dont-need-lodash-underscore\",\n dependencies: [\"lodash\", \"eslint-plugin-you-dont-need-lodash-underscore\"],\n },\n {\n configName: \"mdx\",\n dependencies: [\"eslint-plugin-mdx\"],\n oneOfDependency: [\"nextra\", \"docz\", \"@docusaurus/core\", \"gatsby-plugin-mdx\"],\n resolve: [\"@mdx-js/mdx\", \"remark-mdx\", \"@mdx-js/loader\", \"@mdx-js/rollup\", \"@mdx-js/react\"],\n },\n {\n configName: \"no-unsanitized\",\n dependencies: [\"eslint-plugin-no-unsanitized\"],\n },\n {\n configName: \"react\",\n dependencies: [\"react\", \"react-dom\", \"eslint-plugin-react\"],\n },\n {\n configName: \"react-redux\",\n dependencies: [\"eslint-plugin-react-redux\"],\n oneOfDependency: [\"@reduxjs/toolkit\", \"redux\"],\n },\n {\n configName: \"jsx-a11y\",\n dependencies: [\"react\", \"react-dom\", \"eslint-plugin-jsx-a11y\"],\n },\n {\n configName: \"react-hooks\",\n dependencies: [\"react\", \"react-dom\", \"eslint-plugin-react-hooks\"],\n },\n {\n configName: \"react-usememo\",\n dependencies: [\"react\", \"react-dom\", \"@arthurgeron/eslint-plugin-react-usememo\"],\n },\n {\n configName: \"you-dont-need-momentjs\",\n dependencies: [\"moment\", \"eslint-plugin-you-dont-need-momentjs\"],\n },\n {\n configName: \"you-dont-need-momentjs\",\n dependencies: [\"moment-timezone\", \"eslint-plugin-you-dont-need-momentjs\"],\n },\n {\n configName: \"tailwindcss\",\n dependencies: [\"eslint-plugin-tailwindcss\"],\n },\n {\n configName: \"cypress\",\n dependencies: [\"cypress\", \"eslint-plugin-cypress\"],\n },\n {\n configName: \"jest\",\n dependencies: [\"jest\", \"eslint-plugin-jest\"],\n },\n {\n configName: \"jest-dom\",\n dependencies: [\"jest\", \"@testing-library/jest-dom\", \"eslint-plugin-jest-dom\"],\n },\n {\n configName: \"jest-async\",\n dependencies: [\"jest\", \"eslint-plugin-jest-async\"],\n },\n {\n configName: \"jest-formatting\",\n dependencies: [\"jest\", \"eslint-plugin-jest-formatting\"],\n },\n {\n configName: \"tailwindcss\",\n dependencies: [\"tailwindcss\"],\n },\n {\n configName: \"testing-library-dom\",\n dependencies: [\"@testing-library/dom\", \"eslint-plugin-testing-library\"],\n },\n {\n configName: \"testing-library-react\",\n dependencies: [\"react\", \"@testing-library/react\", \"eslint-plugin-testing-library\"],\n },\n {\n configName: \"typescript\",\n dependencies: [\"typescript\"],\n files: [\"tsconfig.json\", \"tsconfig.eslint.json\"],\n },\n {\n configName: \"etc\",\n dependencies: [\"typescript\", \"eslint-plugin-etc\"],\n },\n {\n configName: \"vitest\",\n dependencies: [\"vitest\", \"eslint-plugin-vitest\"],\n },\n {\n configName: \"zod\",\n dependencies: [\"zod\", \"eslint-plugin-zod\"],\n },\n {\n configName: \"ava\",\n dependencies: [\"ava\", \"eslint-plugin-ava\"],\n },\n {\n configName: \"editorconfig\",\n dependencies: [\"eslint-plugin-editorconfig\"],\n files: [\".editorconfig\"],\n },\n {\n configName: \"storybook\",\n dependencies: [\"storybook\", \"eslint-plugin-storybook\"],\n },\n {\n configName: \"playwright\",\n dependencies: [\"playwright\", \"eslint-plugin-playwright\"],\n },\n {\n configName: \"tanstack-query\",\n dependencies: [\"@tanstack/react-query\", \"@tanstack/eslint-plugin-query\"],\n },\n];\n\nconst loadedPlugins: string[] = [...internalPluginConfig];\nconst possiblePlugins: Record<string, Record<string, boolean>> = {};\n\nif (loadedPlugins.length === internalPluginConfig.length) {\n // eslint-disable-next-line sonarjs/cognitive-complexity\n pluginConfig.forEach((plugin) => {\n const { configName, dependencies } = plugin;\n\n // eslint-disable-next-line security/detect-object-injection\n if ((anolilabEslintConfig as unknown as Record<string, Record<string, false | undefined>>)[\"plugin\"]?.[configName] !== false) {\n const foundDependencies = [];\n\n dependencies.forEach((dependency) => {\n if (hasDependency(dependency) || hasDevDependency(dependency)) {\n foundDependencies.push(dependency);\n }\n });\n\n // eslint-disable-next-line security/detect-object-injection\n possiblePlugins[configName] = {};\n\n if (foundDependencies.length === 0) {\n if (plugin.oneOfDependency !== undefined) {\n let foundOneOfDependency = false;\n\n plugin.oneOfDependency.forEach((dependency) => {\n if (!foundOneOfDependency && (hasDependency(dependency) || hasDevDependency(dependency))) {\n foundOneOfDependency = true;\n\n // eslint-disable-next-line security/detect-object-injection\n (possiblePlugins[configName] as Record<string, boolean>)[dependency] = true;\n }\n });\n }\n\n if (plugin.resolve !== undefined) {\n plugin.resolve.forEach((rdependency) => {\n if (resolvePackage(rdependency) !== undefined) {\n // eslint-disable-next-line security/detect-object-injection\n (possiblePlugins[configName] as Record<string, boolean>)[rdependency] = true;\n }\n });\n }\n\n if (plugin.files !== undefined) {\n plugin.files.forEach((file) => {\n if (hasFile(file)) {\n // eslint-disable-next-line security/detect-object-injection\n (possiblePlugins[configName] as Record<string, boolean>)[file] = true;\n }\n });\n }\n }\n\n if (foundDependencies.length === dependencies.length) {\n // eslint-disable-next-line security/detect-object-injection,@typescript-eslint/no-dynamic-delete\n delete possiblePlugins[configName];\n\n loadedPlugins.push(configName);\n } else {\n dependencies.forEach((dependency) => {\n // eslint-disable-next-line security/detect-object-injection\n (possiblePlugins[configName] as Record<string, boolean>)[dependency] = hasDependency(dependency) || hasDevDependency(dependency);\n });\n }\n }\n });\n}\n\nexport const rules = baseConfig;\nexport const pluginRules = loadedPlugins;\n\nexport const possiblePluginRules = possiblePlugins;\n","/**\nDefine the rules config that are overwritten only for specific version of Node.js based on `engines.node` in package.json or the `nodeVersion` option.\n\nThe keys are rule names and the values are an Object with a valid semver (`4.0.0` is valid `4` is not) as keys and the rule configuration as values.\n\nEach entry define the rule config and the maximum Node.js version for which to set it.\nThe entry with the lowest version that is compliant with the `engines.node`/`nodeVersion` range will be used.\n\n@type {Object}\n\n@example\n```\n{\n 'plugin/rule': {\n '6.0.0': ['error', {prop: 'node-6-conf'}],\n '8.0.0': ['error', {prop: 'node-8-conf'}]\n }\n}\n```\n\nWith `engines.node` set to `>=4` the rule `plugin/rule` will not be used.\nWith `engines.node` set to `>=6` the rule `plugin/rule` will be used with the config `{prop: 'node-6-conf'}`.\nWith `engines.node` set to `>=8` the rule `plugin/rule` will be used with the config `{prop: 'node-8-conf'}`.\n*/\nconst engineRules = {\n \"n/prefer-global/text-decoder\": {\n \"11.0.0\": \"off\",\n },\n \"n/prefer-global/text-encoder\": {\n \"11.0.0\": \"off\",\n },\n \"n/prefer-global/url\": {\n \"10.0.0\": \"off\",\n },\n \"n/prefer-global/url-search-params\": {\n \"10.0.0\": \"off\",\n },\n \"n/prefer-promises/dns\": {\n \"11.14.0\": \"off\",\n },\n \"n/prefer-promises/fs\": {\n \"11.14.0\": \"off\",\n },\n \"no-useless-catch\": {\n \"10.0.0\": \"off\",\n },\n \"prefer-destructuring\": {\n \"6.0.0\": \"off\",\n },\n \"prefer-named-capture-group\": {\n \"10.0.0\": \"off\",\n },\n \"prefer-object-spread\": {\n \"8.3.0\": \"off\",\n },\n \"prefer-rest-params\": {\n \"6.0.0\": \"off\",\n },\n \"promise/prefer-await-to-then\": {\n \"7.6.0\": \"off\",\n },\n \"unicorn/no-new-buffer\": {\n \"5.10.0\": \"off\",\n },\n \"unicorn/prefer-flat-map\": {\n \"11.0.0\": \"off\",\n },\n \"unicorn/prefer-spread\": {\n \"5.0.0\": \"off\",\n },\n};\n\nexport default engineRules;\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/config.ts","../src/engine-node-overwrite.ts"],"names":["hasDependency","hasDevDependency","packageIsTypeModule","pkg","globals","join","semver","hasFile","resolvePackage","baseConfig","internalPluginConfig","pluginConfig","loadedPlugins","possiblePlugins","plugin","configName","dependencies","eslint_config_default","foundDependencies","dependency","foundOneOfDependency","rdependency","file","rules","pluginRules","possiblePluginRules","engineRules","engine_node_overwrite_default","consoleLog","name","consolePlugin","hasLogged","installed","configRules","nodeVersion","rule","ruleConfig","minVersion","config","src_default"],"mappings":"mHAYA,MAAO,mDAEP,OAAS,iBAAAA,EAAe,oBAAAC,EAAkB,uBAAAC,EAAqB,OAAAC,MAAW,+BAE1E,OAAOC,MAAa,UACpB,OAAS,QAAAC,MAAY,OACrB,OAAOC,MAAY,SClBnB,OAAS,iBAAAN,EAAe,oBAAAC,EAAkB,WAAAM,EAAS,kBAAAC,MAAsB,+BAKzE,IAAMC,EAAa,CAAC,iBAAkB,SAAU,QAAS,MAAO,WAAW,EAG9DC,EAAuB,CAChC,SACA,kBACA,SACA,UACA,qBACA,mBACA,OAEA,aACA,UACA,WACA,SAEA,QACA,WACA,OACA,MACA,OAGA,QACA,UACA,KACA,eACJ,EAEMC,EAA6B,CAC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AW,YAAYS,CAAM,KAAK,CAAC,EAEjE,GAAGU,EAAY,IAAKV,GAAWT,EAAK,UAAW,oBAAoBS,CAAM,KAAK,CAAC,CACnF,EACA,QAAS,CACL,GAAGV,EAAQ,QACX,GAAGA,EAAQ,WACf,EACA,eAAgB,CACZ,MAEA,QACA,gBACA,oBACA,iBACA,QAEA,WACA,YACA,eACA,UAEA,SACA,QACA,OAEA,aAKA,SAEA,gBACJ,EACA,UAAW,CACP,CACI,MAAO,CAAC,yBAAyB,EACjC,MAAO,CACH,wBAAyB,KAC7B,CACJ,EACA,CACI,MAAO,CAEH,wBACA,wBAGA,6BACA,6BAGA,uBACJ,EACA,MAAO,CACH,mBAAoB,MACpB,8BAA+B,KACnC,CACJ,EAEA,CACI,MAAOF,EAAsB,CAAC,OAAQ,OAAO,EAAI,CAAC,OAAO,EACzD,OAAQ,uBACR,cAAe,CACX,aAAc,CACV,QAAS,CAAC,wCAAwC,CACtD,EACA,kBAAmB,EACvB,CACJ,CACJ,EAEA,OAAQ,GAER,MAAO,CACH,GAAG+B,CACP,CACJ,EAEOM,EAAQD","sourcesContent":["/**\n * rushstack eslint-patch is used to include plugins as dev\n * dependencies instead of imposing them as peer dependencies\n *\n * {@link https://www.npmjs.com/package/@rushstack/eslint-patch}\n * {@link https://stackoverflow.com/a/74478635/1392749}\n * {@link https://github.com/eslint/eslint/issues/3458}\n * {@link https://eslint.org/blog/2022/08/new-config-system-part-1/}\n * {@link https://eslint.org/blog/2022/08/new-config-system-part-2/}\n * {@link https://eslint.org/blog/2022/08/new-config-system-part-3/}\n * {@link https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new}\n */\nimport \"@rushstack/eslint-patch/modern-module-resolution\";\n\nimport { hasDependency, hasDevDependency, packageIsTypeModule, pkg } from \"@anolilab/package-json-utils\";\nimport type { Linter } from \"eslint\";\nimport globals from \"globals\";\nimport { join } from \"node:path\";\nimport semver from \"semver\";\n\nimport { internalPluginConfig, pluginRules, possiblePluginRules, rules } from \"./config\";\nimport engineRules from \"./engine-node-overwrite\";\nimport anolilabEslintConfig from \"./utils/eslint-config\";\nimport { consoleLog, consolePlugin } from \"./utils/loggers\";\n\n// Workaround VS Code trying to run this file twice!\nif (!global.hasAnolilabEsLintConfigLoaded) {\n if (process.env[\"DEBUG\"]) {\n consoleLog(\"\\n@anolilab/eslint-config loaded the following plugins:\\n\");\n\n consoleLog(\" @rushstack/eslint-plugin-security\");\n internalPluginConfig\n .map((name: string) => {\n if (name === \"import\") {\n return \"i\";\n }\n\n if (name === \"node\") {\n return \"n\";\n }\n\n return name;\n })\n .forEach((plugin) => consolePlugin(plugin));\n }\n\n let hasLogged = false;\n\n Object.entries(possiblePluginRules).forEach(([plugin, dependencies]) => {\n const hasOneDependency = Object.values(dependencies).some(Boolean);\n\n if (hasOneDependency) {\n hasLogged = true;\n\n consoleLog(\n `\\nYour package.json container dependencies for the \"${plugin}\" eslint-plugin, please add the following dependencies with your chosen package manager to enable this plugin:`,\n );\n\n Object.entries(dependencies).forEach(([dependency, installed]) => {\n if (!installed) {\n consoleLog(` ${dependency}`);\n }\n });\n }\n });\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (hasLogged) {\n consoleLog(\"\\nTo disable this message, add the following to your package.json:\");\n consoleLog(' \"anolilab\": { \"eslint-config\": { plugin: { \"plugin-name\": false } } }\\n');\n }\n\n consoleLog('To disable all logging, add the following to your eslint command call \"NO_LOGS=true eslint ...\"');\n\n global.hasAnolilabEsLintConfigLoaded = true;\n}\n\nconst configRules: Linter.RulesRecord = {};\nlet nodeVersion: string | undefined;\n\nif (pkg?.engines?.[\"node\"]) {\n nodeVersion = pkg.engines[\"node\"];\n}\n\nObject.entries(engineRules).forEach(([rule, ruleConfig]) => {\n Object.keys(ruleConfig)\n .sort(semver.rcompare)\n .forEach((minVersion) => {\n if (nodeVersion && semver.intersects(nodeVersion, `<${minVersion}`)) {\n // eslint-disable-next-line security/detect-object-injection\n configRules[rule] = ruleConfig[minVersion as keyof typeof ruleConfig] as Linter.RuleEntry;\n }\n });\n});\n\n// Workaround VS Code trying to run this file twice!\nif (!global.hasAnolilabEsLintConfigPrettier && (hasDependency(\"prettier\") || hasDevDependency(\"prettier\"))) {\n global.hasAnolilabEsLintConfigPrettier = true;\n\n if (anolilabEslintConfig[\"info_on_disabling_prettier_conflict_rule\"] !== false) {\n consoleLog(\"\\nFound prettier as dependency, disabling some rules to fix wrong behavior of the rule with eslint and prettier\");\n }\n}\n\nconst config: Linter.Config = {\n // After an .eslintrc.js file is loaded, ESLint will normally continue visiting all parent folders\n // to look for other .eslintrc.js files, and also consult a personal file ~/.eslintrc.js. If any files\n // are found, their options will be merged. This is difficult for humans to understand, and it will cause\n // nondeterministic behavior if files are loaded from outside the Git working folder.\n //\n // Setting root=true causes ESLint to stop looking for other config files after the first .eslintrc.js\n extends: [\n ...rules.map((plugin) => join(__dirname, `./config/${plugin}.js`)),\n\n ...pluginRules.map((plugin) => join(__dirname, `./config/plugins/${plugin}.js`)),\n ],\n globals: {\n ...globals.browser,\n ...globals.nodeBuiltin,\n },\n ignorePatterns: [\n \"!.*\",\n\n \".git/\",\n \"node_modules/\",\n \"bower_components/\",\n \"jspm_packages/\",\n \".npm/\",\n\n \"lib-cov/\",\n \"coverage/\",\n \".nyc_output/\",\n \".cache/\",\n\n \"build/\",\n \"dist/\",\n \"tmp/\",\n\n \"**/*.min.*\",\n\n // Manually authored .d.ts files are generally used to describe external APIs that are not expected\n // to follow our coding conventions. Linting those files tends to produce a lot of spurious suppressions,\n // so we simply ignore them.\n \"*.d.ts\",\n\n \"pnpm-lock.yaml\",\n ],\n overrides: [\n {\n files: [\"**/migrations/*.{js,ts}\"],\n rules: {\n \"filenames/match-regex\": \"off\",\n },\n },\n {\n files: [\n // Test files\n \"**/*.spec.{js,ts,tsx}\",\n \"**/*.test.{js,ts,tsx}\",\n\n // Facebook convention\n \"**/__mocks__/*.{js,ts,tsx}\",\n \"**/__tests__/*.{js,ts,tsx}\",\n\n // Microsoft convention\n \"**/test/*.{js,ts,tsx}\",\n ],\n rules: {\n \"no-magic-numbers\": \"off\",\n \"sonarjs/no-duplicate-string\": \"off\",\n },\n },\n // Fixes https://github.com/eslint/eslint/discussions/15305\n {\n files: packageIsTypeModule ? [\"*.js\", \"*.mjs\"] : [\"*.mjs\"],\n parser: \"@babel/eslint-parser\",\n parserOptions: {\n babelOptions: {\n plugins: [\"@babel/plugin-syntax-import-assertions\"],\n },\n requireConfigFile: false,\n },\n },\n ],\n // Disable the parser by default\n parser: \"\",\n // is loaded.\n rules: {\n ...configRules,\n },\n};\n\nexport default config;\n","import { hasDependency, hasDevDependency, hasFile, resolvePackage } from \"@anolilab/package-json-utils\";\n\nimport type { PackageRules } from \"./types\";\nimport anolilabEslintConfig from \"./utils/eslint-config\";\n\nconst baseConfig = [\"best-practices\", \"errors\", \"style\", \"es6\", \"variables\"];\n\n// eslint-disable-next-line import/exports-last\nexport const internalPluginConfig = [\n \"compat\",\n \"eslint-comments\",\n \"import\",\n \"promise\",\n \"simple-import-sort\",\n \"no-extend-native\",\n \"node\",\n // Security Rules\n \"no-secrets\",\n \"sonarjs\",\n \"security\",\n \"regexp\",\n // file rules\n \"jsonc\",\n \"markdown\",\n \"toml\",\n \"yml\",\n \"html\",\n\n // custom rules\n \"antfu\",\n \"unicorn\",\n \"es\",\n \"perfectionist\",\n];\n\nconst pluginConfig: PackageRules = [\n {\n configName: \"array-func\",\n dependencies: [\"eslint-plugin-array-func\"],\n },\n {\n configName: \"jsdoc\",\n dependencies: [\"eslint-plugin-jsdoc\"],\n },\n {\n configName: \"tsdoc\",\n dependencies: [\"eslint-plugin-tsdoc\", \"typescript\"],\n },\n {\n configName: \"lodash\",\n dependencies: [\"lodash\", \"eslint-plugin-lodash\"],\n },\n {\n configName: \"lodash-fp\",\n dependencies: [\"lodash\", \"eslint-plugin-lodash-fp\"],\n },\n {\n configName: \"you-dont-need-lodash-underscore\",\n dependencies: [\"lodash\", \"eslint-plugin-you-dont-need-lodash-underscore\"],\n },\n {\n configName: \"mdx\",\n dependencies: [\"eslint-plugin-mdx\"],\n oneOfDependency: [\"nextra\", \"docz\", \"@docusaurus/core\", \"gatsby-plugin-mdx\"],\n resolve: [\"@mdx-js/mdx\", \"remark-mdx\", \"@mdx-js/loader\", \"@mdx-js/rollup\", \"@mdx-js/react\"],\n },\n {\n configName: \"no-unsanitized\",\n dependencies: [\"eslint-plugin-no-unsanitized\"],\n },\n {\n configName: \"react\",\n dependencies: [\"react\", \"react-dom\", \"eslint-plugin-react\"],\n },\n {\n configName: \"react-redux\",\n dependencies: [\"eslint-plugin-react-redux\"],\n oneOfDependency: [\"@reduxjs/toolkit\", \"redux\"],\n },\n {\n configName: \"jsx-a11y\",\n dependencies: [\"react\", \"react-dom\", \"eslint-plugin-jsx-a11y\"],\n },\n {\n configName: \"react-hooks\",\n dependencies: [\"react\", \"react-dom\", \"eslint-plugin-react-hooks\"],\n },\n {\n configName: \"react-usememo\",\n dependencies: [\"react\", \"react-dom\", \"@arthurgeron/eslint-plugin-react-usememo\"],\n },\n {\n configName: \"you-dont-need-momentjs\",\n dependencies: [\"moment\", \"eslint-plugin-you-dont-need-momentjs\"],\n },\n {\n configName: \"you-dont-need-momentjs\",\n dependencies: [\"moment-timezone\", \"eslint-plugin-you-dont-need-momentjs\"],\n },\n {\n configName: \"tailwindcss\",\n dependencies: [\"eslint-plugin-tailwindcss\"],\n },\n {\n configName: \"cypress\",\n dependencies: [\"cypress\", \"eslint-plugin-cypress\"],\n },\n {\n configName: \"jest\",\n dependencies: [\"jest\", \"eslint-plugin-jest\"],\n },\n {\n configName: \"jest-dom\",\n dependencies: [\"jest\", \"@testing-library/jest-dom\", \"eslint-plugin-jest-dom\"],\n },\n {\n configName: \"jest-async\",\n dependencies: [\"jest\", \"eslint-plugin-jest-async\"],\n },\n {\n configName: \"jest-formatting\",\n dependencies: [\"jest\", \"eslint-plugin-jest-formatting\"],\n },\n {\n configName: \"tailwindcss\",\n dependencies: [\"tailwindcss\"],\n },\n {\n configName: \"testing-library-dom\",\n dependencies: [\"@testing-library/dom\", \"eslint-plugin-testing-library\"],\n },\n {\n configName: \"testing-library-react\",\n dependencies: [\"react\", \"@testing-library/react\", \"eslint-plugin-testing-library\"],\n },\n {\n configName: \"typescript\",\n dependencies: [\"typescript\"],\n files: [\"tsconfig.json\", \"tsconfig.eslint.json\"],\n },\n {\n configName: \"etc\",\n dependencies: [\"typescript\", \"eslint-plugin-etc\"],\n },\n {\n configName: \"vitest\",\n dependencies: [\"vitest\", \"eslint-plugin-vitest\", \"eslint-plugin-vitest-globals\"],\n },\n {\n configName: \"zod\",\n dependencies: [\"zod\", \"eslint-plugin-zod\"],\n },\n {\n configName: \"ava\",\n dependencies: [\"ava\", \"eslint-plugin-ava\"],\n },\n {\n configName: \"editorconfig\",\n dependencies: [\"eslint-plugin-editorconfig\"],\n files: [\".editorconfig\"],\n },\n {\n configName: \"storybook\",\n dependencies: [\"storybook\", \"eslint-plugin-storybook\"],\n },\n {\n configName: \"playwright\",\n dependencies: [\"playwright\", \"eslint-plugin-playwright\"],\n },\n {\n configName: \"tanstack-query\",\n dependencies: [\"@tanstack/react-query\", \"@tanstack/eslint-plugin-query\"],\n },\n];\n\nconst loadedPlugins: string[] = [...internalPluginConfig];\nconst possiblePlugins: Record<string, Record<string, boolean>> = {};\n\nif (loadedPlugins.length === internalPluginConfig.length) {\n // eslint-disable-next-line sonarjs/cognitive-complexity\n pluginConfig.forEach((plugin) => {\n const { configName, dependencies } = plugin;\n\n // eslint-disable-next-line security/detect-object-injection\n if ((anolilabEslintConfig as unknown as Record<string, Record<string, false | undefined>>)[\"plugin\"]?.[configName] !== false) {\n const foundDependencies = [];\n\n dependencies.forEach((dependency) => {\n if (hasDependency(dependency) || hasDevDependency(dependency)) {\n foundDependencies.push(dependency);\n }\n });\n\n // eslint-disable-next-line security/detect-object-injection\n possiblePlugins[configName] = {};\n\n if (foundDependencies.length === 0) {\n if (plugin.oneOfDependency !== undefined) {\n let foundOneOfDependency = false;\n\n plugin.oneOfDependency.forEach((dependency) => {\n if (!foundOneOfDependency && (hasDependency(dependency) || hasDevDependency(dependency))) {\n foundOneOfDependency = true;\n\n // eslint-disable-next-line security/detect-object-injection\n (possiblePlugins[configName] as Record<string, boolean>)[dependency] = true;\n }\n });\n }\n\n if (plugin.resolve !== undefined) {\n plugin.resolve.forEach((rdependency) => {\n if (resolvePackage(rdependency) !== undefined) {\n // eslint-disable-next-line security/detect-object-injection\n (possiblePlugins[configName] as Record<string, boolean>)[rdependency] = true;\n }\n });\n }\n\n if (plugin.files !== undefined) {\n plugin.files.forEach((file) => {\n if (hasFile(file)) {\n // eslint-disable-next-line security/detect-object-injection\n (possiblePlugins[configName] as Record<string, boolean>)[file] = true;\n }\n });\n }\n }\n\n if (foundDependencies.length === dependencies.length) {\n // eslint-disable-next-line security/detect-object-injection,@typescript-eslint/no-dynamic-delete\n delete possiblePlugins[configName];\n\n loadedPlugins.push(configName);\n } else {\n dependencies.forEach((dependency) => {\n // eslint-disable-next-line security/detect-object-injection\n (possiblePlugins[configName] as Record<string, boolean>)[dependency] = hasDependency(dependency) || hasDevDependency(dependency);\n });\n }\n }\n });\n}\n\nexport const rules = baseConfig;\nexport const pluginRules = loadedPlugins;\n\nexport const possiblePluginRules = possiblePlugins;\n","/**\nDefine the rules config that are overwritten only for specific version of Node.js based on `engines.node` in package.json or the `nodeVersion` option.\n\nThe keys are rule names and the values are an Object with a valid semver (`4.0.0` is valid `4` is not) as keys and the rule configuration as values.\n\nEach entry define the rule config and the maximum Node.js version for which to set it.\nThe entry with the lowest version that is compliant with the `engines.node`/`nodeVersion` range will be used.\n\n@type {Object}\n\n@example\n```\n{\n 'plugin/rule': {\n '6.0.0': ['error', {prop: 'node-6-conf'}],\n '8.0.0': ['error', {prop: 'node-8-conf'}]\n }\n}\n```\n\nWith `engines.node` set to `>=4` the rule `plugin/rule` will not be used.\nWith `engines.node` set to `>=6` the rule `plugin/rule` will be used with the config `{prop: 'node-6-conf'}`.\nWith `engines.node` set to `>=8` the rule `plugin/rule` will be used with the config `{prop: 'node-8-conf'}`.\n*/\nconst engineRules = {\n \"n/prefer-global/text-decoder\": {\n \"11.0.0\": \"off\",\n },\n \"n/prefer-global/text-encoder\": {\n \"11.0.0\": \"off\",\n },\n \"n/prefer-global/url\": {\n \"10.0.0\": \"off\",\n },\n \"n/prefer-global/url-search-params\": {\n \"10.0.0\": \"off\",\n },\n \"n/prefer-promises/dns\": {\n \"11.14.0\": \"off\",\n },\n \"n/prefer-promises/fs\": {\n \"11.14.0\": \"off\",\n },\n \"no-useless-catch\": {\n \"10.0.0\": \"off\",\n },\n \"prefer-destructuring\": {\n \"6.0.0\": \"off\",\n },\n \"prefer-named-capture-group\": {\n \"10.0.0\": \"off\",\n },\n \"prefer-object-spread\": {\n \"8.3.0\": \"off\",\n },\n \"prefer-rest-params\": {\n \"6.0.0\": \"off\",\n },\n \"promise/prefer-await-to-then\": {\n \"7.6.0\": \"off\",\n },\n \"unicorn/no-new-buffer\": {\n \"5.10.0\": \"off\",\n },\n \"unicorn/prefer-flat-map\": {\n \"11.0.0\": \"off\",\n },\n \"unicorn/prefer-spread\": {\n \"5.0.0\": \"off\",\n },\n};\n\nexport default engineRules;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anolilab/eslint-config",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.3.0",
|
|
4
4
|
"description": "ESLint shareable config for the Anolilab JavaScript style guide.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -126,20 +126,20 @@
|
|
|
126
126
|
"postinstall": "node ./skip.js || node ./dist/postinstall.js"
|
|
127
127
|
},
|
|
128
128
|
"dependencies": {
|
|
129
|
-
"@anolilab/package-json-utils": "3.0.
|
|
130
|
-
"@babel/eslint-parser": "^7.22.
|
|
129
|
+
"@anolilab/package-json-utils": "3.0.4",
|
|
130
|
+
"@babel/eslint-parser": "^7.22.10",
|
|
131
131
|
"@babel/plugin-syntax-import-assertions": "^7.22.5",
|
|
132
132
|
"@html-eslint/eslint-plugin": "^0.19.1",
|
|
133
133
|
"@html-eslint/parser": "^0.19.1",
|
|
134
|
-
"@rushstack/eslint-patch": "^1.3.
|
|
134
|
+
"@rushstack/eslint-patch": "^1.3.3",
|
|
135
135
|
"@rushstack/eslint-plugin-security": "^0.6.0",
|
|
136
|
-
"@typescript-eslint/eslint-plugin": ">=6.
|
|
137
|
-
"@typescript-eslint/parser": "^6.
|
|
136
|
+
"@typescript-eslint/eslint-plugin": ">=6.3.0",
|
|
137
|
+
"@typescript-eslint/parser": "^6.3.0",
|
|
138
138
|
"confusing-browser-globals": "^1.0.11",
|
|
139
139
|
"eslint-define-config": "^1.23.0",
|
|
140
|
-
"eslint-import-resolver-node": "^0.3.
|
|
141
|
-
"eslint-import-resolver-typescript": "^3.
|
|
142
|
-
"eslint-plugin-antfu": "^0.40.
|
|
140
|
+
"eslint-import-resolver-node": "^0.3.9",
|
|
141
|
+
"eslint-import-resolver-typescript": "^3.6.0",
|
|
142
|
+
"eslint-plugin-antfu": "^0.40.2",
|
|
143
143
|
"eslint-plugin-compat": "^4.1.4",
|
|
144
144
|
"eslint-plugin-es-x": "^7.2.0",
|
|
145
145
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
"eslint-plugin-i": "^2.28.0",
|
|
148
148
|
"eslint-plugin-jsonc": "^2.9.0",
|
|
149
149
|
"eslint-plugin-markdown": "^3.0.1",
|
|
150
|
-
"eslint-plugin-mdx": "^2.
|
|
150
|
+
"eslint-plugin-mdx": "^2.2.0",
|
|
151
151
|
"eslint-plugin-no-loops": "^0.3.0",
|
|
152
152
|
"eslint-plugin-no-secrets": "^0.8.9",
|
|
153
153
|
"eslint-plugin-no-use-extend-native": "^0.5.0",
|
|
@@ -170,7 +170,7 @@
|
|
|
170
170
|
"yaml-eslint-parser": "^1.2.2"
|
|
171
171
|
},
|
|
172
172
|
"devDependencies": {
|
|
173
|
-
"@anolilab/semantic-release-preset": "6.0.
|
|
173
|
+
"@anolilab/semantic-release-preset": "6.0.4",
|
|
174
174
|
"@arthurgeron/eslint-plugin-react-usememo": "^1.1.4",
|
|
175
175
|
"@testing-library/dom": "^9.3.1",
|
|
176
176
|
"@total-typescript/ts-reset": "^0.4.2",
|
|
@@ -180,7 +180,7 @@
|
|
|
180
180
|
"eslint": "^8.46.0",
|
|
181
181
|
"eslint-find-rules": "^4.1.0",
|
|
182
182
|
"eslint-plugin-babel": "^5.3.1",
|
|
183
|
-
"eslint-plugin-cypress": "^2.
|
|
183
|
+
"eslint-plugin-cypress": "^2.14.0",
|
|
184
184
|
"eslint-plugin-editorconfig": "^4.0.3",
|
|
185
185
|
"eslint-plugin-etc": "^2.0.3",
|
|
186
186
|
"eslint-plugin-jest": "^27.2.3",
|
|
@@ -206,7 +206,7 @@
|
|
|
206
206
|
"rimraf": "^5.0.1",
|
|
207
207
|
"semantic-release": "^21.0.7",
|
|
208
208
|
"tsup": "^7.2.0",
|
|
209
|
-
"type-fest": "^4.
|
|
209
|
+
"type-fest": "^4.2.0",
|
|
210
210
|
"typescript": "^5.1.6",
|
|
211
211
|
"vitest": "^0.34.1"
|
|
212
212
|
},
|
|
@@ -219,7 +219,7 @@
|
|
|
219
219
|
"eslint-plugin-array-func": "^3.1.8",
|
|
220
220
|
"eslint-plugin-ava": "^14.0.0",
|
|
221
221
|
"eslint-plugin-babel": "^5.3.1",
|
|
222
|
-
"eslint-plugin-cypress": "^2.
|
|
222
|
+
"eslint-plugin-cypress": "^2.14.0",
|
|
223
223
|
"eslint-plugin-editorconfig": "^4.0.3",
|
|
224
224
|
"eslint-plugin-jest": "^27.2.3",
|
|
225
225
|
"eslint-plugin-jest-async": "^1.0.3",
|