@anolilab/eslint-config 6.1.7 → 7.0.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 +29 -0
- package/README.md +35 -18
- package/dist/chunk-5IW32NSH.mjs +5 -0
- package/dist/chunk-5IW32NSH.mjs.map +1 -0
- package/dist/{chunk-6E2RGUNG.js → chunk-5S3UQ6WJ.js} +1 -1
- package/dist/{chunk-6E2RGUNG.js.map → chunk-5S3UQ6WJ.js.map} +1 -1
- package/dist/{chunk-GPLU2T35.mjs → chunk-5XOTKQJY.mjs} +1 -1
- package/dist/{chunk-GPLU2T35.mjs.map → chunk-5XOTKQJY.mjs.map} +1 -1
- package/dist/{chunk-72JA2E3L.js → chunk-EOABR2FR.js} +1 -1
- package/dist/{chunk-72JA2E3L.js.map → chunk-EOABR2FR.js.map} +1 -1
- package/dist/{chunk-NH6CJJWC.mjs → chunk-KNKUBOMM.mjs} +1 -1
- package/dist/chunk-KNKUBOMM.mjs.map +1 -0
- package/dist/{chunk-ZRBLJAQI.js → chunk-MLDIWITS.js} +1 -1
- package/dist/chunk-MLDIWITS.js.map +1 -0
- package/dist/{chunk-WDMF75TJ.mjs → chunk-U5JQC7EA.mjs} +1 -1
- package/dist/{chunk-WDMF75TJ.mjs.map → chunk-U5JQC7EA.mjs.map} +1 -1
- package/dist/chunk-VJL7NPM4.js +8 -0
- package/dist/chunk-VJL7NPM4.js.map +1 -0
- package/dist/config/best-practices.js +2 -2
- package/dist/config/best-practices.mjs +1 -1
- package/dist/config/plugins/antfu.js +2 -2
- package/dist/config/plugins/antfu.js.map +1 -1
- package/dist/config/plugins/antfu.mjs +1 -1
- package/dist/config/plugins/antfu.mjs.map +1 -1
- package/dist/config/plugins/array-func.js +2 -2
- package/dist/config/plugins/array-func.js.map +1 -1
- package/dist/config/plugins/array-func.mjs +1 -1
- package/dist/config/plugins/array-func.mjs.map +1 -1
- package/dist/config/plugins/babel.js +4 -4
- package/dist/config/plugins/babel.js.map +1 -1
- package/dist/config/plugins/babel.mjs +3 -3
- package/dist/config/plugins/babel.mjs.map +1 -1
- package/dist/config/plugins/html.js +2 -2
- package/dist/config/plugins/html.mjs +1 -1
- package/dist/config/plugins/import.js +2 -2
- package/dist/config/plugins/import.mjs +1 -1
- package/dist/config/plugins/jest.js +1 -1
- package/dist/config/plugins/jest.js.map +1 -1
- package/dist/config/plugins/jest.mjs +1 -1
- package/dist/config/plugins/jest.mjs.map +1 -1
- package/dist/config/plugins/mdx.js +2 -2
- package/dist/config/plugins/mdx.js.map +1 -1
- package/dist/config/plugins/mdx.mjs +2 -2
- package/dist/config/plugins/mdx.mjs.map +1 -1
- package/dist/config/plugins/react.js +5 -6
- package/dist/config/plugins/react.js.map +1 -1
- package/dist/config/plugins/react.mjs +4 -5
- package/dist/config/plugins/react.mjs.map +1 -1
- package/dist/config/plugins/regexp.js +9 -0
- package/dist/config/plugins/regexp.js.map +1 -0
- package/dist/config/plugins/regexp.mjs +7 -0
- package/dist/config/plugins/regexp.mjs.map +1 -0
- package/dist/config/plugins/sonarjs.js +4 -2
- package/dist/config/plugins/sonarjs.js.map +1 -1
- package/dist/config/plugins/sonarjs.mjs +4 -2
- package/dist/config/plugins/sonarjs.mjs.map +1 -1
- package/dist/config/plugins/tailwindcss.js +4 -2
- package/dist/config/plugins/tailwindcss.js.map +1 -1
- package/dist/config/plugins/tailwindcss.mjs +4 -2
- package/dist/config/plugins/tailwindcss.mjs.map +1 -1
- package/dist/config/plugins/testing-library.js +3 -2
- package/dist/config/plugins/testing-library.js.map +1 -1
- package/dist/config/plugins/testing-library.mjs +4 -3
- package/dist/config/plugins/testing-library.mjs.map +1 -1
- package/dist/config/plugins/tsdoc.js +2 -2
- package/dist/config/plugins/tsdoc.js.map +1 -1
- package/dist/config/plugins/tsdoc.mjs +1 -1
- package/dist/config/plugins/tsdoc.mjs.map +1 -1
- package/dist/config/plugins/typescript.js +4 -4
- package/dist/config/plugins/typescript.mjs +3 -3
- package/dist/config/plugins/unicorn.js +2 -2
- package/dist/config/plugins/unicorn.mjs +1 -1
- package/dist/config/style.js +2 -2
- package/dist/config/style.mjs +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/typescript-type-checking.js +3 -3
- package/dist/typescript-type-checking.js.map +1 -1
- package/dist/typescript-type-checking.mjs +2 -2
- package/dist/typescript-type-checking.mjs.map +1 -1
- package/package.json +6 -6
- package/dist/chunk-GWJVUZVN.js +0 -7
- package/dist/chunk-GWJVUZVN.js.map +0 -1
- package/dist/chunk-NH6CJJWC.mjs.map +0 -1
- package/dist/chunk-WP674HT2.mjs +0 -5
- package/dist/chunk-WP674HT2.mjs.map +0 -1
- package/dist/chunk-ZRBLJAQI.js.map +0 -1
- package/dist/config/plugins/optimize-regex.js +0 -7
- package/dist/config/plugins/optimize-regex.js.map +0 -1
- package/dist/config/plugins/optimize-regex.mjs +0 -5
- package/dist/config/plugins/optimize-regex.mjs.map +0 -1
- /package/dist/config/plugins/{optimize-regex.d.ts → regexp.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
## @anolilab/eslint-config [7.0.0](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/eslint-config@6.1.8...@anolilab/eslint-config@7.0.0) (2023-06-23)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### ⚠ BREAKING CHANGES
|
|
5
|
+
|
|
6
|
+
* removed commitlint from semantic-releases and added all rules to the new commitlint-config package
|
|
7
|
+
|
|
8
|
+
Signed-off-by: prisis <d.bannert@anolilab.de>
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* added regexp, optimized linting with added files regex to some rules, fixed the testing-library rules, to work correct ([485ae0c](https://github.com/anolilab/javascript-style-guide/commit/485ae0cdb445b9297c3287ae08910f693b6ac09b))
|
|
13
|
+
* removed commitlint from semantic-releases ([ee2cda1](https://github.com/anolilab/javascript-style-guide/commit/ee2cda12d7d8c9f12c3dc2a3a1070babb4b81f5c))
|
|
14
|
+
* removed eslint-plugin-optimize-regex, using the unicorn rule for it ([3fea9de](https://github.com/anolilab/javascript-style-guide/commit/3fea9de9fc88713d40dffa66daa8b835210ae3ba))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Dependencies
|
|
19
|
+
|
|
20
|
+
* **@anolilab/package-json-utils:** upgraded to 1.5.0
|
|
21
|
+
* **@anolilab/semantic-release-preset:** upgraded to 4.0.0
|
|
22
|
+
|
|
23
|
+
## @anolilab/eslint-config [6.1.8](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/eslint-config@6.1.7...@anolilab/eslint-config@6.1.8) (2023-06-22)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* fixed wrong import, added better plugin login for testing-library ([857d734](https://github.com/anolilab/javascript-style-guide/commit/857d734cead4f1551bc466888d854a9ab6ab0a4a))
|
|
29
|
+
|
|
1
30
|
## @anolilab/eslint-config [6.1.7](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/eslint-config@6.1.6...@anolilab/eslint-config@6.1.7) (2023-06-22)
|
|
2
31
|
|
|
3
32
|
|
package/README.md
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
# Anolilab ESLint config
|
|
2
|
-
|
|
3
|
-
This package provides Anolilab’s most comprehensive code style guide as an extensible shared config.
|
|
4
|
-
|
|
5
|
-
With a range of useful plugins that are often too time-consuming to setup, based on your project’s dependencies we will notify you about missing eslint plugins.
|
|
6
|
-
|
|
7
|
-
The goal is to reduce noise in code version control and promote use of the latest ES features.
|
|
8
|
-
|
|
9
1
|
<div align="center">
|
|
10
2
|
|
|
3
|
+
<h1>Shareable ESLint config</h1>
|
|
4
|
+
|
|
11
5
|
[![typescript-image]][typescript-url] [![npm-image]][npm-url] [![license-image]][license-url]
|
|
12
6
|
|
|
13
7
|
</div>
|
|
@@ -24,6 +18,22 @@ The goal is to reduce noise in code version control and promote use of the lates
|
|
|
24
18
|
|
|
25
19
|
---
|
|
26
20
|
|
|
21
|
+
## Purpose
|
|
22
|
+
|
|
23
|
+
Our package serves as a valuable resource for JavaScript/Typescript-based projects, offering composable [ESLint](https://eslint.org/) configurations. It encompasses a range of features, including performance optimization and the flexibility to extend pre-defined base configurations.
|
|
24
|
+
|
|
25
|
+
- Tailored Configuration for Workspaces: With this package, each workspace within your monorepo gains the ability to have its own customized ESLint configuration. This ensures that individual projects can maintain their specific requirements while still adhering to the overall guidelines.
|
|
26
|
+
|
|
27
|
+
- Configurability at Your Fingertips: Crafting your workspace's ESLint configuration is a breeze, thanks to the seamless composition of pre-defined base configurations. This empowers you to tailor the settings to suit your project's unique needs, without starting from scratch.
|
|
28
|
+
|
|
29
|
+
- Streamlined Convenience: Say goodbye to the hassle of installing plugins for each workspace. Our package integrates [@rushstack/eslint-patch](https://www.npmjs.com/package/@rushstack/eslint-patch), eliminating the need for repetitive plugin installations. Enjoy peace of mind as you focus on your work, knowing that the necessary plugins are automatically included.
|
|
30
|
+
|
|
31
|
+
- Enhanced Efficiency: We've optimized the package's performance by intelligently enabling plugins based on file naming conventions. This streamlined approach ensures that your ESLint checks run efficiently, targeting the relevant files and maximizing productivity.
|
|
32
|
+
|
|
33
|
+
In summary, our package provides comprehensive and adaptable ESLint configurations for JavaScript and Typescript projects. It empowers you to achieve code quality while minimizing overhead and maximizing productivity throughout your workspaces.
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
27
37
|
## Highlights
|
|
28
38
|
|
|
29
39
|
- Zero-config, but configurable when needed.
|
|
@@ -41,22 +51,22 @@ The goal is to reduce noise in code version control and promote use of the lates
|
|
|
41
51
|
To install this config, run the following command.
|
|
42
52
|
|
|
43
53
|
```bash
|
|
44
|
-
npm install eslint @anolilab/eslint-config
|
|
54
|
+
npm install --save-dev eslint @anolilab/eslint-config
|
|
45
55
|
```
|
|
46
56
|
|
|
47
57
|
```sh
|
|
48
|
-
|
|
58
|
+
pnpm add -D eslint @anolilab/eslint-config
|
|
49
59
|
```
|
|
50
60
|
|
|
51
61
|
```sh
|
|
52
|
-
|
|
62
|
+
yarn add -D eslint @anolilab/eslint-config
|
|
53
63
|
```
|
|
54
64
|
|
|
55
65
|
## Usage
|
|
56
66
|
|
|
57
|
-
If you don’t have a `.eslintrc.
|
|
67
|
+
If you don’t have a `.eslintrc.js`, we will create the file for you after installing `@anolilab/eslint-config`.
|
|
58
68
|
|
|
59
|
-
If you already have a `.eslintrc.
|
|
69
|
+
If you already have a `.eslintrc.js`, then you can extend the `.eslintrc.js`, with `@anolilab/eslint-config`.
|
|
60
70
|
|
|
61
71
|
> Note: Our default export contains all of our ESLint rules, including ECMAScript 6+. `@anolilab/eslint-config` use the `ecmaVersion`:`2021` as default.
|
|
62
72
|
>
|
|
@@ -97,7 +107,7 @@ For more advanced use cases see the example configurations for Node, TypeScript,
|
|
|
97
107
|
npm install --save-dev eslint typescript @anolilab/eslint-config
|
|
98
108
|
```
|
|
99
109
|
|
|
100
|
-
Please extend the `.eslintrc.
|
|
110
|
+
Please extend the `.eslintrc.js` file with the correct `tsconfig.js` path if you have a custom path.
|
|
101
111
|
|
|
102
112
|
```js
|
|
103
113
|
module.exports = {
|
|
@@ -109,7 +119,7 @@ module.exports = {
|
|
|
109
119
|
|
|
110
120
|
For projects that use TypeScript and want additional rules that require type information (rules using type information take longer to run).
|
|
111
121
|
|
|
112
|
-
Extend the `.eslintrc.
|
|
122
|
+
Extend the `.eslintrc.js` file:
|
|
113
123
|
|
|
114
124
|
```js
|
|
115
125
|
module.children = {
|
|
@@ -135,6 +145,12 @@ module.children = {
|
|
|
135
145
|
};
|
|
136
146
|
```
|
|
137
147
|
|
|
148
|
+
> Tip: Run eslint with the TIMING=1 to identify slow rules.
|
|
149
|
+
>
|
|
150
|
+
> `TIMING=1 eslint . --ext .ts,.tsx`
|
|
151
|
+
>
|
|
152
|
+
> This is useful to identify rules that are slow because they require type information.
|
|
153
|
+
|
|
138
154
|
### React
|
|
139
155
|
|
|
140
156
|
You need to have "react" and "react-dom" installed.
|
|
@@ -145,7 +161,7 @@ You need to have "react" and "react-dom" installed.
|
|
|
145
161
|
|
|
146
162
|
Or for the use of `TypeScript` in react install "typescript" as a dev dependency.
|
|
147
163
|
|
|
148
|
-
Please extend the `.eslintrc.
|
|
164
|
+
Please extend the `.eslintrc.js` file with the correct `tsconfig.js` path if you have a custom path.
|
|
149
165
|
|
|
150
166
|
```js
|
|
151
167
|
module.exports = {
|
|
@@ -161,6 +177,8 @@ module.exports = {
|
|
|
161
177
|
npm install --save-dev eslint eslint-plugin-mdx @anolilab/eslint-config
|
|
162
178
|
```
|
|
163
179
|
|
|
180
|
+
For more information about `missing` or `optional` to install rules see the `eslint` console output.
|
|
181
|
+
|
|
164
182
|
### Config
|
|
165
183
|
|
|
166
184
|
You can configure `@anolilab/eslint-config` options with your `package.json` file.
|
|
@@ -334,7 +352,7 @@ The following plugins expand esLint to work with json files, and lint JavaScript
|
|
|
334
352
|
- [eslint-plugin-toml](https://github.com/ota-meshi/eslint-plugin-toml)
|
|
335
353
|
- [eslint-plugin-yml](https://github.com/ota-meshi/eslint-plugin-yml)
|
|
336
354
|
|
|
337
|
-
When linting code snippets in Markdown files, a few [rules](src/
|
|
355
|
+
When linting code snippets in Markdown files, a few [rules](src/config/plugins/markdown.ts#L3) relating to globals and unused vars are disabled.
|
|
338
356
|
|
|
339
357
|
### Library Plugins
|
|
340
358
|
|
|
@@ -356,7 +374,6 @@ The following esLint plugins enforce good coding practices:
|
|
|
356
374
|
|
|
357
375
|
- [eslint-plugin-array-func](https://github.com/freaktechnik/eslint-plugin-array-func)
|
|
358
376
|
- [eslint-plugin-eslint-comments](https://github.com/mysticatea/eslint-plugin-eslint-comments)
|
|
359
|
-
- [eslint-plugin-optimize-regex](https://github.com/BrainMaestro/eslint-plugin-optimize-regex)
|
|
360
377
|
- [eslint-plugin-promise](https://github.com/xjamundx/eslint-plugin-promise)
|
|
361
378
|
- [eslint-plugin-no-loops](https://github.com/buildo/eslint-plugin-no-loops)
|
|
362
379
|
- [eslint-plugin-simple-import-sort](https://github.com/lydell/eslint-plugin-simple-import-sort)
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var r=s=>{switch(s){case"typescript":return ["*.ts","*.tsx","*.mts","*.cts"];case"jsx_and_tsx":return ["*.jsx","*.tsx"];case"js_and_ts":return ["*.js","*.mjs","*.cjs","*.ts","*.mts","*.cts"];case"javascript":return ["*.js","*.mjs","*.cjs"];case"all":return ["*.js","*.jsx","*.mjs","*.cjs","*.ts","*.tsx","*.mts","*.cts"];case"jest":return ["**/*.spec.{js,ts,tsx}","**/*.test.{js,ts,tsx}","**/test/*.{js,ts,tsx}","**/__mocks__/*.{js,ts,tsx}","**/__tests__/*.{js,ts,tsx}"];case"ava":return ["test.js","src/test.js","source/test.js","**/test-*.js","**/*.spec.js","**/*.test.js","**/test/**/*.js","**/tests/**/*.js","**/__tests__/**/*.js"];case"vitest":return ["**/__tests__/**/*.?(c|m)[jt]s?(x)","**/?(*.){test,spec}.?(c|m)[jt]s?(x)"];case"tests":return ["test.js","src/test.js","source/test.js","**/test-*.js","**/*.spec.js","**/*.test.js","**/test/**/*.js","**/tests/**/*.js","**/__tests__/**/*.js","**/*.spec.{js,ts,tsx}","**/*.test.{js,ts,tsx}","**/test/*.{js,ts,tsx}","**/__mocks__/*.{js,ts,tsx}","**/__tests__/*.{js,ts,tsx}","**/__tests__/**/*.?(c|m)[jt]s?(x)","**/?(*.){test,spec}.?(c|m)[jt]s?(x)"];default:throw new Error(`Unknown type: ${s}`)}},j=(s,t,e)=>({env:e,overrides:[{files:r(s),...t}]}),c=s=>({overrides:s.map(({type:t,config:e})=>({files:r(t),...e}))});
|
|
2
|
+
|
|
3
|
+
export { j as a, c as b };
|
|
4
|
+
//# sourceMappingURL=out.js.map
|
|
5
|
+
//# sourceMappingURL=chunk-5IW32NSH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/create-config.ts"],"names":["getType","type","createConfig","config","environment","createConfigs","rules"],"mappings":"AAIA,IAAMA,EAAWC,GAAmB,CAChC,OAAQA,EAAM,CACV,IAAK,aAED,MAAO,CAAC,OAAQ,QAAS,QAAS,OAAO,EAE7C,IAAK,cACD,MAAO,CAAC,QAAS,OAAO,EAE5B,IAAK,YACD,MAAO,CAAC,OAAQ,QAAS,QAAS,OAAQ,QAAS,OAAO,EAE9D,IAAK,aACD,MAAO,CAAC,OAAQ,QAAS,OAAO,EAEpC,IAAK,MACD,MAAO,CAAC,OAAQ,QAAS,QAAS,QAAS,OAAQ,QAAS,QAAS,OAAO,EAEhF,IAAK,OACD,MAAO,CAEH,wBACA,wBACA,wBAGA,6BACA,4BACJ,EAEJ,IAAK,MACD,MAAO,CACH,UACA,cACA,iBACA,eACA,eACA,eACA,kBACA,mBACA,sBACJ,EAEJ,IAAK,SACD,MAAO,CAAC,oCAAqC,qCAAqC,EAEtF,IAAK,QACD,MAAO,CAEH,UACA,cACA,iBACA,eACA,eACA,eACA,kBACA,mBACA,uBAGA,wBACA,wBACA,wBACA,6BACA,6BACA,oCACA,qCACJ,EAEJ,QACI,MAAM,IAAI,MAAM,iBAAiBA,GAAM,CAE/C,CACJ,EAEaC,EAAe,CACxBD,EACAE,EACAC,KAEO,CACH,IAAKA,EACL,UAAW,CACP,CACI,MAAOJ,EAAQC,CAAI,EACnB,GAAGE,CACP,CACJ,CACJ,GAESE,EACTC,IAKO,CACH,UAAWA,EAAM,IAAI,CAAC,CAAE,KAAAL,EAAM,OAAAE,CAAO,KAC1B,CACH,MAAOH,EAAQC,CAAI,EACnB,GAAGE,CACP,EACH,CACL","sourcesContent":["import type { Linter } from \"eslint\";\n\ntype FileType = \"all\" | \"ava\" | \"javascript\" | \"jest\" | \"js_and_ts\" | \"jsx_and_tsx\" | \"tests\" | \"typescript\" | \"vitest\";\n\nconst getType = (type: FileType) => {\n switch (type) {\n case \"typescript\": {\n // @see https://devblogs.microsoft.com/typescript/announcing-typescript-4-5-beta/#new-file-extensions\n return [\"*.ts\", \"*.tsx\", \"*.mts\", \"*.cts\"];\n }\n case \"jsx_and_tsx\": {\n return [\"*.jsx\", \"*.tsx\"];\n }\n case \"js_and_ts\": {\n return [\"*.js\", \"*.mjs\", \"*.cjs\", \"*.ts\", \"*.mts\", \"*.cts\"];\n }\n case \"javascript\": {\n return [\"*.js\", \"*.mjs\", \"*.cjs\"];\n }\n case \"all\": {\n return [\"*.js\", \"*.jsx\", \"*.mjs\", \"*.cjs\", \"*.ts\", \"*.tsx\", \"*.mts\", \"*.cts\"];\n }\n case \"jest\": {\n return [\n // Test files\n \"**/*.spec.{js,ts,tsx}\",\n \"**/*.test.{js,ts,tsx}\",\n \"**/test/*.{js,ts,tsx}\",\n\n // Facebook convention\n \"**/__mocks__/*.{js,ts,tsx}\",\n \"**/__tests__/*.{js,ts,tsx}\",\n ];\n }\n case \"ava\": {\n return [\n \"test.js\",\n \"src/test.js\",\n \"source/test.js\",\n \"**/test-*.js\",\n \"**/*.spec.js\",\n \"**/*.test.js\",\n \"**/test/**/*.js\",\n \"**/tests/**/*.js\",\n \"**/__tests__/**/*.js\",\n ];\n }\n case \"vitest\": {\n return [\"**/__tests__/**/*.?(c|m)[jt]s?(x)\", \"**/?(*.){test,spec}.?(c|m)[jt]s?(x)\"];\n }\n case \"tests\": {\n return [\n // ava\n \"test.js\",\n \"src/test.js\",\n \"source/test.js\",\n \"**/test-*.js\",\n \"**/*.spec.js\",\n \"**/*.test.js\",\n \"**/test/**/*.js\",\n \"**/tests/**/*.js\",\n \"**/__tests__/**/*.js\",\n\n // jest\n \"**/*.spec.{js,ts,tsx}\",\n \"**/*.test.{js,ts,tsx}\",\n \"**/test/*.{js,ts,tsx}\",\n \"**/__mocks__/*.{js,ts,tsx}\",\n \"**/__tests__/*.{js,ts,tsx}\",\n \"**/__tests__/**/*.?(c|m)[jt]s?(x)\",\n \"**/?(*.){test,spec}.?(c|m)[jt]s?(x)\",\n ];\n }\n default: {\n throw new Error(`Unknown type: ${type}`);\n }\n }\n};\n\nexport const createConfig = (\n type: FileType,\n config: Omit<Linter.ConfigOverride<Linter.RulesRecord>, \"files\">,\n environment?: { [name: string]: boolean },\n): Linter.Config => {\n return {\n env: environment,\n overrides: [\n {\n files: getType(type),\n ...config,\n },\n ],\n };\n};\nexport const createConfigs = (\n rules: {\n config: Omit<Linter.ConfigOverride<Linter.RulesRecord>, \"files\">;\n type: FileType;\n }[],\n): Linter.Config => {\n return {\n overrides: rules.map(({ type, config }) => {\n return {\n files: getType(type),\n ...config,\n };\n }),\n };\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/config/best-practices.ts"],"names":["config","best_practices_default"],"mappings":"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","sourcesContent":["import type { Linter } from \"eslint\";\n\nconst config: Linter.Config = {\n rules: {\n // enforces getter/setter pairs in objects\n \"accessor-pairs\": \"off\",\n\n // enforces return statements in callbacks of array's methods\n // https://eslint.org/docs/rules/array-callback-return\n \"array-callback-return\": [\"error\", { allowImplicit: true }],\n\n // treat var statements as if they were block scoped\n \"block-scoped-var\": \"error\",\n\n // specify the maximum cyclomatic complexity allowed in a program\n complexity: [\"off\", 11],\n\n // enforce that class methods use \"this\"\n // https://eslint.org/docs/rules/class-methods-use-this\n \"class-methods-use-this\": [\n \"error\",\n {\n exceptMethods: [],\n },\n ],\n\n // require return statements to either always or never specify values\n \"consistent-return\": \"error\",\n\n // specify curly brace conventions for all control statements\n curly: [\"error\", \"multi-line\"], // multiline\n\n // require default case in switch statements\n \"default-case\": [\"error\", { commentPattern: \"^no default$\" }],\n\n // Enforce default clauses in switch statements to be last\n // https://eslint.org/docs/rules/default-case-last\n \"default-case-last\": \"error\",\n\n // https://eslint.org/docs/rules/default-param-last\n \"default-param-last\": \"error\",\n\n // enforces consistent newlines before or after dots\n // https://eslint.org/docs/rules/dot-location\n \"dot-location\": [\"error\", \"property\"],\n\n // require the use of === and !==\n // https://eslint.org/docs/rules/eqeqeq\n eqeqeq: [\"error\", \"always\", { null: \"ignore\" }],\n\n // Require grouped accessor pairs in object literals and classes\n // https://eslint.org/docs/rules/grouped-accessor-pairs\n \"grouped-accessor-pairs\": \"error\",\n\n // make sure for-in loops have an if statement\n \"guard-for-in\": \"error\",\n\n // enforce a maximum number of classes per file\n // https://eslint.org/docs/rules/max-classes-per-file\n \"max-classes-per-file\": [\"error\", 1],\n\n // disallow the use of alert, confirm, and prompt\n \"no-alert\": \"error\",\n\n // disallow use of arguments.caller or arguments.callee\n \"no-caller\": \"error\",\n\n // disallow lexical declarations in case/default clauses\n // https://eslint.org/docs/rules/no-case-declarations.html\n \"no-case-declarations\": \"error\",\n\n // Disallow returning value in constructor\n // https://eslint.org/docs/rules/no-constructor-return\n \"no-constructor-return\": \"error\",\n\n // disallow division operators explicitly at beginning of regular expression\n // https://eslint.org/docs/rules/no-div-regex\n \"no-div-regex\": \"off\",\n\n // disallow else after a return in an if\n // https://eslint.org/docs/rules/no-else-return\n \"no-else-return\": [\"error\", { allowElseIf: false }],\n\n // disallow empty functions, except for standalone funcs/arrows\n // https://eslint.org/docs/rules/no-empty-function\n \"no-empty-function\": [\n \"error\",\n {\n allow: [\"arrowFunctions\", \"functions\", \"methods\"],\n },\n ],\n\n // disallow empty destructuring patterns\n // https://eslint.org/docs/rules/no-empty-pattern\n \"no-empty-pattern\": \"error\",\n\n // Disallow empty static blocks\n // https://eslint.org/docs/latest/rules/no-empty-static-block\n \"no-empty-static-block\": \"error\",\n\n // disallow comparisons to null without a type-checking operator\n \"no-eq-null\": \"off\",\n\n // disallow use of eval()\n \"no-eval\": \"error\",\n\n // disallow adding to native types\n \"no-extend-native\": \"error\",\n\n // disallow unnecessary function binding\n \"no-extra-bind\": \"error\",\n\n // disallow Unnecessary Labels\n // https://eslint.org/docs/rules/no-extra-label\n \"no-extra-label\": \"error\",\n\n // disallow fallthrough of case statements\n \"no-fallthrough\": \"error\",\n\n // disallow the use of leading or trailing decimal points in numeric literals\n \"no-floating-decimal\": \"error\",\n\n // disallow reassignments of native objects or read-only globals\n // https://eslint.org/docs/rules/no-global-assign\n \"no-global-assign\": [\"error\", { exceptions: [] }],\n // deprecated in favor of no-global-assign\n \"no-native-reassign\": \"off\",\n\n // disallow implicit type conversions\n // https://eslint.org/docs/rules/no-implicit-coercion\n \"no-implicit-coercion\": [\n \"off\",\n {\n boolean: false,\n number: true,\n string: true,\n allow: [],\n },\n ],\n\n // disallow var and named functions in global scope\n // https://eslint.org/docs/rules/no-implicit-globals\n \"no-implicit-globals\": \"off\",\n\n // disallow use of eval()-like methods\n \"no-implied-eval\": \"error\",\n\n // disallow this keywords outside of classes or class-like objects\n \"no-invalid-this\": \"off\",\n\n // disallow usage of __iterator__ property\n \"no-iterator\": \"error\",\n\n // disallow use of labels for anything other than loops and switches\n \"no-labels\": [\"error\", { allowLoop: false, allowSwitch: false }],\n\n // disallow unnecessary nested blocks\n \"no-lone-blocks\": \"error\",\n\n // disallow creation of functions within loops\n \"no-loop-func\": \"error\",\n\n // disallow magic numbers\n // https://eslint.org/docs/rules/no-magic-numbers\n \"no-magic-numbers\": [\n \"off\",\n {\n ignore: [],\n ignoreArrayIndexes: true,\n enforceConst: true,\n detectObjects: false,\n },\n ],\n\n // disallow use of multiple spaces\n \"no-multi-spaces\": [\n \"error\",\n {\n ignoreEOLComments: false,\n },\n ],\n\n // disallow use of multiline strings\n \"no-multi-str\": \"error\",\n\n // disallow use of new operator when not part of the assignment or comparison\n \"no-new\": \"error\",\n\n // disallow use of new operator for Function object\n \"no-new-func\": \"error\",\n\n // disallows creating new instances of String, Number, and Boolean\n \"no-new-wrappers\": \"error\",\n\n // Disallow \\8 and \\9 escape sequences in string literals\n // https://eslint.org/docs/rules/no-nonoctal-decimal-escape\n \"no-nonoctal-decimal-escape\": \"error\",\n\n // disallow use of (old style) octal literals\n \"no-octal\": \"error\",\n\n // disallow use of octal escape sequences in string literals, such as\n // var foo = 'Copyright \\251';\n \"no-octal-escape\": \"error\",\n\n // disallow reassignment of function parameters\n // disallow parameter object manipulation except for specific exclusions\n // rule: https://eslint.org/docs/rules/no-param-reassign.html\n \"no-param-reassign\": [\n \"error\",\n {\n props: true,\n ignorePropertyModificationsFor: [\n \"acc\", // for reduce accumulators\n \"accumulator\", // for reduce accumulators\n \"e\", // for e.returnvalue\n \"ctx\", // for Koa routing\n \"context\", // for Koa routing\n \"req\", // for Express requests\n \"request\", // for Express requests\n \"res\", // for Express responses\n \"response\", // for Express responses\n \"$scope\", // for Angular 1 scopes\n \"staticContext\", // for ReactRouter context\n ],\n },\n ],\n\n // disallow usage of __proto__ property\n \"no-proto\": \"error\",\n\n // disallow declaring the same variable more than once\n \"no-redeclare\": \"error\",\n\n // disallow certain object properties\n // https://eslint.org/docs/rules/no-restricted-properties\n \"no-restricted-properties\": [\n \"error\",\n {\n object: \"arguments\",\n property: \"callee\",\n message: \"arguments.callee is deprecated\",\n },\n {\n object: \"global\",\n property: \"isFinite\",\n // eslint-disable-next-line sonarjs/no-duplicate-string\n message: \"Please use Number.isFinite instead\",\n },\n {\n object: \"self\",\n property: \"isFinite\",\n message: \"Please use Number.isFinite instead\",\n },\n {\n object: \"window\",\n property: \"isFinite\",\n message: \"Please use Number.isFinite instead\",\n },\n {\n object: \"global\",\n property: \"isNaN\",\n // eslint-disable-next-line sonarjs/no-duplicate-string\n message: \"Please use Number.isNaN instead\",\n },\n {\n object: \"self\",\n property: \"isNaN\",\n message: \"Please use Number.isNaN instead\",\n },\n {\n object: \"window\",\n property: \"isNaN\",\n message: \"Please use Number.isNaN instead\",\n },\n {\n property: \"__defineGetter__\",\n message: \"Please use Object.defineProperty instead.\",\n },\n {\n property: \"__defineSetter__\",\n message: \"Please use Object.defineProperty instead.\",\n },\n {\n object: \"Math\",\n property: \"pow\",\n message: \"Use the exponentiation operator (**) instead.\",\n },\n {\n object: \"globalThis\",\n property: \"isNaN\",\n message: \"Use `Number.isNaN` instead.\",\n },\n {\n object: \"globalThis\",\n property: \"isFinite\",\n message: \"Use `Number.isFinite` instead.\",\n },\n {\n object: \"globalThis\",\n property: \"parseFloat\",\n message: \"Use `Number.parseFloat` instead.\",\n },\n {\n object: \"globalThis\",\n property: \"parseInt\",\n message: \"Use `Number.parseInt` instead.\",\n },\n {\n object: \"window\",\n property: \"parseFloat\",\n message: \"Use `Number.parseFloat` instead.\",\n },\n {\n object: \"window\",\n property: \"parseInt\",\n message: \"Use `Number.parseInt` instead.\",\n },\n {\n property: \"__proto__\",\n message: \"Use `Object.getPrototypeOf` instead.\",\n },\n {\n property: \"__lookupGetter__\",\n message: \"Use `Object.getOwnPropertyDescriptor` instead.\",\n },\n {\n property: \"__lookupSetter__\",\n message: \"Use `Object.getOwnPropertyDescriptor` instead.\",\n },\n ],\n\n // disallow use of assignment in return statement\n \"no-return-assign\": [\"error\", \"always\"],\n\n // disallow redundant `return await`\n \"no-return-await\": \"error\",\n\n // disallow use of `javascript:` urls.\n \"no-script-url\": \"error\",\n\n // disallow self assignment\n // https://eslint.org/docs/rules/no-self-assign\n \"no-self-assign\": [\n \"error\",\n {\n props: true,\n },\n ],\n\n // disallow comparisons where both sides are exactly the same\n \"no-self-compare\": \"error\",\n\n // disallow use of comma operator\n \"no-sequences\": \"error\",\n\n // restrict what can be thrown as an exception\n \"no-throw-literal\": \"error\",\n\n // disallow unmodified conditions of loops\n // https://eslint.org/docs/rules/no-unmodified-loop-condition\n \"no-unmodified-loop-condition\": \"off\",\n\n // disallow usage of expressions in statement position\n \"no-unused-expressions\": [\n \"error\",\n {\n allowShortCircuit: false,\n allowTernary: false,\n allowTaggedTemplates: false,\n },\n ],\n\n // disallow unused labels\n // https://eslint.org/docs/rules/no-unused-labels\n \"no-unused-labels\": \"error\",\n\n // disallow unnecessary .call() and .apply()\n \"no-useless-call\": \"off\",\n\n // Disallow unnecessary catch clauses\n // https://eslint.org/docs/rules/no-useless-catch\n \"no-useless-catch\": \"error\",\n\n // disallow useless string concatenation\n // https://eslint.org/docs/rules/no-useless-concat\n \"no-useless-concat\": \"error\",\n\n // disallow unnecessary string escaping\n // https://eslint.org/docs/rules/no-useless-escape\n \"no-useless-escape\": \"error\",\n\n // disallow redundant return; keywords\n // https://eslint.org/docs/rules/no-useless-return\n \"no-useless-return\": \"error\",\n\n // disallow use of void operator\n // https://eslint.org/docs/rules/no-void\n \"no-void\": \"error\",\n\n // disallow usage of configurable warning terms in comments: e.g. todo\n \"no-warning-comments\": [\n \"off\",\n {\n terms: [\"todo\", \"fixme\", \"xxx\", \"@todo\"],\n location: \"start\",\n },\n ],\n\n // disallow use of the with statement\n \"no-with\": \"error\",\n\n // require using Error objects as Promise rejection reasons\n // https://eslint.org/docs/rules/prefer-promise-reject-errors\n \"prefer-promise-reject-errors\": [\"error\", { allowEmptyReject: true }],\n\n // Suggest using named capture group in regular expression\n // https://eslint.org/docs/rules/prefer-named-capture-group\n \"prefer-named-capture-group\": \"off\",\n\n // https://eslint.org/docs/rules/prefer-regex-literals\n \"prefer-regex-literals\": \"error\",\n\n // require use of the second argument for parseInt()\n radix: \"error\",\n\n // require `await` in `async function` (note: this is a horrible rule that should never be used)\n // https://eslint.org/docs/rules/require-await\n \"require-await\": \"off\",\n\n // Enforce the use of u flag on RegExp\n // https://eslint.org/docs/rules/require-unicode-regexp\n \"require-unicode-regexp\": \"off\",\n\n // requires to declare all vars on top of their containing scope\n \"vars-on-top\": \"error\",\n\n // require immediate function invocation to be wrapped in parentheses\n // https://eslint.org/docs/rules/wrap-iife.html\n \"wrap-iife\": [\"error\", \"outside\", { functionPrototypeMethods: false }],\n\n // require or disallow Yoda conditions\n yoda: \"error\",\n // encourages use of dot notation whenever possible\n \"dot-notation\": [\"error\", { allowKeywords: true }],\n },\n};\n\nexport default config;\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/config/best-practices.ts"],"names":["config","best_practices_default"],"mappings":"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","sourcesContent":["import type { Linter } from \"eslint\";\n\nconst config: Linter.Config = {\n rules: {\n // enforces getter/setter pairs in objects\n \"accessor-pairs\": \"off\",\n\n // enforces return statements in callbacks of array's methods\n // https://eslint.org/docs/rules/array-callback-return\n \"array-callback-return\": [\"error\", { allowImplicit: true }],\n\n // treat var statements as if they were block scoped\n \"block-scoped-var\": \"error\",\n\n // specify the maximum cyclomatic complexity allowed in a program\n complexity: [\"off\", 11],\n\n // enforce that class methods use \"this\"\n // https://eslint.org/docs/rules/class-methods-use-this\n \"class-methods-use-this\": [\n \"error\",\n {\n exceptMethods: [],\n },\n ],\n\n // require return statements to either always or never specify values\n \"consistent-return\": \"error\",\n\n // specify curly brace conventions for all control statements\n curly: [\"error\", \"multi-line\"], // multiline\n\n // require default case in switch statements\n \"default-case\": [\"error\", { commentPattern: \"^no default$\" }],\n\n // Enforce default clauses in switch statements to be last\n // https://eslint.org/docs/rules/default-case-last\n \"default-case-last\": \"error\",\n\n // https://eslint.org/docs/rules/default-param-last\n \"default-param-last\": \"error\",\n\n // enforces consistent newlines before or after dots\n // https://eslint.org/docs/rules/dot-location\n \"dot-location\": [\"error\", \"property\"],\n\n // require the use of === and !==\n // https://eslint.org/docs/rules/eqeqeq\n eqeqeq: [\"error\", \"always\", { null: \"ignore\" }],\n\n // Require grouped accessor pairs in object literals and classes\n // https://eslint.org/docs/rules/grouped-accessor-pairs\n \"grouped-accessor-pairs\": \"error\",\n\n // make sure for-in loops have an if statement\n \"guard-for-in\": \"error\",\n\n // enforce a maximum number of classes per file\n // https://eslint.org/docs/rules/max-classes-per-file\n \"max-classes-per-file\": [\"error\", 1],\n\n // disallow the use of alert, confirm, and prompt\n \"no-alert\": \"error\",\n\n // disallow use of arguments.caller or arguments.callee\n \"no-caller\": \"error\",\n\n // disallow lexical declarations in case/default clauses\n // https://eslint.org/docs/rules/no-case-declarations.html\n \"no-case-declarations\": \"error\",\n\n // Disallow returning value in constructor\n // https://eslint.org/docs/rules/no-constructor-return\n \"no-constructor-return\": \"error\",\n\n // disallow division operators explicitly at beginning of regular expression\n // https://eslint.org/docs/rules/no-div-regex\n \"no-div-regex\": \"off\",\n\n // disallow else after a return in an if\n // https://eslint.org/docs/rules/no-else-return\n \"no-else-return\": [\"error\", { allowElseIf: false }],\n\n // disallow empty functions, except for standalone funcs/arrows\n // https://eslint.org/docs/rules/no-empty-function\n \"no-empty-function\": [\n \"error\",\n {\n allow: [\"arrowFunctions\", \"functions\", \"methods\"],\n },\n ],\n\n // disallow empty destructuring patterns\n // https://eslint.org/docs/rules/no-empty-pattern\n \"no-empty-pattern\": \"error\",\n\n // Disallow empty static blocks\n // https://eslint.org/docs/latest/rules/no-empty-static-block\n \"no-empty-static-block\": \"error\",\n\n // disallow comparisons to null without a type-checking operator\n \"no-eq-null\": \"off\",\n\n // disallow use of eval()\n \"no-eval\": \"error\",\n\n // disallow adding to native types\n \"no-extend-native\": \"error\",\n\n // disallow unnecessary function binding\n \"no-extra-bind\": \"error\",\n\n // disallow Unnecessary Labels\n // https://eslint.org/docs/rules/no-extra-label\n \"no-extra-label\": \"error\",\n\n // disallow fallthrough of case statements\n \"no-fallthrough\": \"error\",\n\n // disallow the use of leading or trailing decimal points in numeric literals\n \"no-floating-decimal\": \"error\",\n\n // disallow reassignments of native objects or read-only globals\n // https://eslint.org/docs/rules/no-global-assign\n \"no-global-assign\": [\"error\", { exceptions: [] }],\n // deprecated in favor of no-global-assign\n \"no-native-reassign\": \"off\",\n\n // disallow implicit type conversions\n // https://eslint.org/docs/rules/no-implicit-coercion\n \"no-implicit-coercion\": [\n \"off\",\n {\n boolean: false,\n number: true,\n string: true,\n allow: [],\n },\n ],\n\n // disallow var and named functions in global scope\n // https://eslint.org/docs/rules/no-implicit-globals\n \"no-implicit-globals\": \"off\",\n\n // disallow use of eval()-like methods\n \"no-implied-eval\": \"error\",\n\n // disallow this keywords outside of classes or class-like objects\n \"no-invalid-this\": \"off\",\n\n // disallow usage of __iterator__ property\n \"no-iterator\": \"error\",\n\n // disallow use of labels for anything other than loops and switches\n \"no-labels\": [\"error\", { allowLoop: false, allowSwitch: false }],\n\n // disallow unnecessary nested blocks\n \"no-lone-blocks\": \"error\",\n\n // disallow creation of functions within loops\n \"no-loop-func\": \"error\",\n\n // disallow magic numbers\n // https://eslint.org/docs/rules/no-magic-numbers\n \"no-magic-numbers\": [\n \"off\",\n {\n ignore: [],\n ignoreArrayIndexes: true,\n enforceConst: true,\n detectObjects: false,\n },\n ],\n\n // disallow use of multiple spaces\n \"no-multi-spaces\": [\n \"error\",\n {\n ignoreEOLComments: false,\n },\n ],\n\n // disallow use of multiline strings\n \"no-multi-str\": \"error\",\n\n // disallow use of new operator when not part of the assignment or comparison\n \"no-new\": \"error\",\n\n // disallow use of new operator for Function object\n \"no-new-func\": \"error\",\n\n // disallows creating new instances of String, Number, and Boolean\n \"no-new-wrappers\": \"error\",\n\n // Disallow \\8 and \\9 escape sequences in string literals\n // https://eslint.org/docs/rules/no-nonoctal-decimal-escape\n \"no-nonoctal-decimal-escape\": \"error\",\n\n // disallow use of (old style) octal literals\n \"no-octal\": \"error\",\n\n // disallow use of octal escape sequences in string literals, such as\n // var foo = 'Copyright \\251';\n \"no-octal-escape\": \"error\",\n\n // disallow reassignment of function parameters\n // disallow parameter object manipulation except for specific exclusions\n // rule: https://eslint.org/docs/rules/no-param-reassign.html\n \"no-param-reassign\": [\n \"error\",\n {\n props: true,\n ignorePropertyModificationsFor: [\n \"acc\", // for reduce accumulators\n \"accumulator\", // for reduce accumulators\n \"e\", // for e.returnvalue\n \"ctx\", // for Koa routing\n \"context\", // for Koa routing\n \"req\", // for Express requests\n \"request\", // for Express requests\n \"res\", // for Express responses\n \"response\", // for Express responses\n \"$scope\", // for Angular 1 scopes\n \"staticContext\", // for ReactRouter context\n ],\n },\n ],\n\n // disallow usage of __proto__ property\n \"no-proto\": \"error\",\n\n // disallow declaring the same variable more than once\n \"no-redeclare\": \"error\",\n\n // disallow certain object properties\n // https://eslint.org/docs/rules/no-restricted-properties\n \"no-restricted-properties\": [\n \"error\",\n {\n object: \"arguments\",\n property: \"callee\",\n message: \"arguments.callee is deprecated\",\n },\n {\n object: \"global\",\n property: \"isFinite\",\n message: \"Please use Number.isFinite instead\",\n },\n {\n object: \"self\",\n property: \"isFinite\",\n message: \"Please use Number.isFinite instead\",\n },\n {\n object: \"window\",\n property: \"isFinite\",\n message: \"Please use Number.isFinite instead\",\n },\n {\n object: \"global\",\n property: \"isNaN\",\n\n message: \"Please use Number.isNaN instead\",\n },\n {\n object: \"self\",\n property: \"isNaN\",\n message: \"Please use Number.isNaN instead\",\n },\n {\n object: \"window\",\n property: \"isNaN\",\n message: \"Please use Number.isNaN instead\",\n },\n {\n property: \"__defineGetter__\",\n message: \"Please use Object.defineProperty instead.\",\n },\n {\n property: \"__defineSetter__\",\n message: \"Please use Object.defineProperty instead.\",\n },\n {\n object: \"Math\",\n property: \"pow\",\n message: \"Use the exponentiation operator (**) instead.\",\n },\n {\n object: \"globalThis\",\n property: \"isNaN\",\n message: \"Use `Number.isNaN` instead.\",\n },\n {\n object: \"globalThis\",\n property: \"isFinite\",\n message: \"Use `Number.isFinite` instead.\",\n },\n {\n object: \"globalThis\",\n property: \"parseFloat\",\n message: \"Use `Number.parseFloat` instead.\",\n },\n {\n object: \"globalThis\",\n property: \"parseInt\",\n message: \"Use `Number.parseInt` instead.\",\n },\n {\n object: \"window\",\n property: \"parseFloat\",\n message: \"Use `Number.parseFloat` instead.\",\n },\n {\n object: \"window\",\n property: \"parseInt\",\n message: \"Use `Number.parseInt` instead.\",\n },\n {\n property: \"__proto__\",\n message: \"Use `Object.getPrototypeOf` instead.\",\n },\n {\n property: \"__lookupGetter__\",\n message: \"Use `Object.getOwnPropertyDescriptor` instead.\",\n },\n {\n property: \"__lookupSetter__\",\n message: \"Use `Object.getOwnPropertyDescriptor` instead.\",\n },\n ],\n\n // disallow use of assignment in return statement\n \"no-return-assign\": [\"error\", \"always\"],\n\n // disallow redundant `return await`\n \"no-return-await\": \"error\",\n\n // disallow use of `javascript:` urls.\n \"no-script-url\": \"error\",\n\n // disallow self assignment\n // https://eslint.org/docs/rules/no-self-assign\n \"no-self-assign\": [\n \"error\",\n {\n props: true,\n },\n ],\n\n // disallow comparisons where both sides are exactly the same\n \"no-self-compare\": \"error\",\n\n // disallow use of comma operator\n \"no-sequences\": \"error\",\n\n // restrict what can be thrown as an exception\n \"no-throw-literal\": \"error\",\n\n // disallow unmodified conditions of loops\n // https://eslint.org/docs/rules/no-unmodified-loop-condition\n \"no-unmodified-loop-condition\": \"off\",\n\n // disallow usage of expressions in statement position\n \"no-unused-expressions\": [\n \"error\",\n {\n allowShortCircuit: false,\n allowTernary: false,\n allowTaggedTemplates: false,\n },\n ],\n\n // disallow unused labels\n // https://eslint.org/docs/rules/no-unused-labels\n \"no-unused-labels\": \"error\",\n\n // disallow unnecessary .call() and .apply()\n \"no-useless-call\": \"off\",\n\n // Disallow unnecessary catch clauses\n // https://eslint.org/docs/rules/no-useless-catch\n \"no-useless-catch\": \"error\",\n\n // disallow useless string concatenation\n // https://eslint.org/docs/rules/no-useless-concat\n \"no-useless-concat\": \"error\",\n\n // disallow unnecessary string escaping\n // https://eslint.org/docs/rules/no-useless-escape\n \"no-useless-escape\": \"error\",\n\n // disallow redundant return; keywords\n // https://eslint.org/docs/rules/no-useless-return\n \"no-useless-return\": \"error\",\n\n // disallow use of void operator\n // https://eslint.org/docs/rules/no-void\n \"no-void\": \"error\",\n\n // disallow usage of configurable warning terms in comments: e.g. todo\n \"no-warning-comments\": [\n \"off\",\n {\n terms: [\"todo\", \"fixme\", \"xxx\", \"@todo\"],\n location: \"start\",\n },\n ],\n\n // disallow use of the with statement\n \"no-with\": \"error\",\n\n // require using Error objects as Promise rejection reasons\n // https://eslint.org/docs/rules/prefer-promise-reject-errors\n \"prefer-promise-reject-errors\": [\"error\", { allowEmptyReject: true }],\n\n // Suggest using named capture group in regular expression\n // https://eslint.org/docs/rules/prefer-named-capture-group\n \"prefer-named-capture-group\": \"off\",\n\n // https://eslint.org/docs/rules/prefer-regex-literals\n \"prefer-regex-literals\": \"error\",\n\n // require use of the second argument for parseInt()\n radix: \"error\",\n\n // require `await` in `async function` (note: this is a horrible rule that should never be used)\n // https://eslint.org/docs/rules/require-await\n \"require-await\": \"off\",\n\n // Enforce the use of u flag on RegExp\n // https://eslint.org/docs/rules/require-unicode-regexp\n \"require-unicode-regexp\": \"off\",\n\n // requires to declare all vars on top of their containing scope\n \"vars-on-top\": \"error\",\n\n // require immediate function invocation to be wrapped in parentheses\n // https://eslint.org/docs/rules/wrap-iife.html\n \"wrap-iife\": [\"error\", \"outside\", { functionPrototypeMethods: false }],\n\n // require or disallow Yoda conditions\n yoda: \"error\",\n // encourages use of dot notation whenever possible\n \"dot-notation\": [\"error\", { allowKeywords: true }],\n },\n};\n\nexport default config;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/config/plugins/import.ts"],"names":["fromRoot","hasTypescript","config","import_default"],"mappings":"AAAA,OAAS,YAAAA,EAAU,iBAAAC,MAAqB,+BAGxC,IAAMC,EAAwB,CAC1B,IAAK,CACD,IAAK,EACT,EACA,cAAe,CACX,YAAa,EACb,WAAY,QAChB,EACA,QAAS,CAAC,QAAQ,EAClB,SAAU,CACN,kBAAmB,CACf,KAAM,CACF,WAAY,CAAC,OAAQ,MAAO,OAAO,CACvC,EACA,GAAID,EACE,CACI,WAAY,CAER,eAAgB,GAChB,QAASD,EAAS,eAAe,CACrC,CACJ,EACA,CAAC,CACX,EACA,GAAIC,EAAgB,CAAE,iBAAkB,CAAE,4BAA6B,CAAC,MAAO,MAAM,CAAE,CAAE,EAAI,CAAC,EAC9F,oBAAqB,CAAC,MAAO,OAAQ,MAAM,EAC3C,sBAAuB,CAAC,EACxB,gBAAiB,CAAC,yCAAyC,CAC/D,EACA,MAAO,CAKH,uBAAwB,CAAC,QAAS,CAAE,SAAU,GAAM,cAAe,EAAK,CAAC,EAIzE,eAAgB,QAIhB,iBAAkB,MAGlB,mBAAoB,MAMpB,gBAAiB,QAIjB,6BAA8B,QAI9B,oCAAqC,QAIrC,uBAAwB,MAKxB,oCAAqC,CACjC,QACA,CACI,gBAAiB,CACb,UACA,WACA,UACA,gBACA,kBACA,gBACA,kBACA,gCACA,qBACA,mBACA,oBACA,wBACA,yBACA,uBACA,wBACA,iBACA,mBACA,qBACA,wBACA,0BACA,mBACA,kBACA,mBACA,oBACA,oBACA,sBACA,sBACA,oCACA,qCACJ,EACA,qBAAsB,EAC1B,CACJ,EAIA,4BAA6B,QAM7B,qBAAsB,MAItB,gBAAiB,QAIjB,2BAA4B,MAM5B,eAAgB,QAKhB,uBAAwB,MAIxB,uBAAwB,QAIxB,sBAAuB,QAIvB,oBAAqB,CACjB,QACA,iBACA,CACI,GAAI,QACJ,IAAK,QACL,IAAK,OACT,CACJ,EAKA,eAAgB,CACZ,QACA,CACI,OAAQ,CAAC,CAAC,UAAW,WAAY,UAAU,CAAC,CAChD,CACJ,EAIA,8BAA+B,QAI/B,+BAAgC,QAIhC,6BAA8B,MAI9B,0BAA2B,CAAC,MAAO,CAAE,IAAK,EAAG,CAAC,EAI9C,0BAA2B,QAI3B,4BAA6B,QAI7B,6BAA8B,CAC1B,MACA,CACI,MAAO,CAAC,CACZ,CACJ,EAOA,qBAAsB,MAItB,kCAAmC,QAKnC,8BAA+B,MAI/B,0BAA2B,QAI3B,qCAAsC,CAClC,MACA,CACI,WAAY,GACZ,mBAAoB,GACpB,oBAAqB,GACrB,uBAAwB,GACxB,aAAc,GACd,YAAa,EACjB,CACJ,EAIA,sBAAuB,QAMvB,uBAAwB,MAIxB,2BAA4B,MAI5B,yBAA0B,MAI1B,wBAAyB,QAIzB,kBAAmB,CAAC,QAAS,CAAE,SAAU,QAAI,CAAC,EAI9C,kCAAmC,CAAC,QAAS,CAAE,SAAU,GAAM,eAAgB,EAAK,CAAC,EAIrF,kCAAmC,CAC/B,MACA,CACI,gBAAiB,CAAC,EAClB,uBAAwB,kBAC5B,CACJ,EAIA,oCAAqC,MAKrC,2BAA4B,MAK5B,yCAA0C,CAAC,MAAO,eAAe,EAIjE,+BAAgC,OACpC,EAEA,UAAW,CACP,CACI,MAAO,CAAC,OAAQ,QAAS,QAAS,OAAO,EACzC,MAAO,CAEH,gBAAiB,MAGjB,iBAAkB,MAIlB,eAAgB,KACpB,CACJ,CACJ,CACJ,EAEOE,EAAQD","sourcesContent":["import { fromRoot, hasTypescript } from \"@anolilab/package-json-utils\";\nimport type { Linter } from \"eslint\";\n\nconst config: Linter.Config = {\n env: {\n es6: true,\n },\n parserOptions: {\n ecmaVersion: 6,\n sourceType: \"module\",\n },\n plugins: [\"import\"],\n settings: {\n \"import/resolver\": {\n node: {\n extensions: [\".mjs\", \".js\", \".json\"],\n },\n ...(hasTypescript\n ? {\n typescript: {\n // eslint-disable-next-line max-len\n alwaysTryTypes: true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`\n project: fromRoot(\"tsconfig.json\"),\n },\n }\n : {}),\n },\n ...(hasTypescript ? { \"import/parsers\": { \"@typescript-eslint/parser\": [\".ts\", \".tsx\"] } } : {}),\n \"import/extensions\": [\".js\", \".mjs\", \".jsx\"],\n \"import/core-modules\": [],\n \"import/ignore\": [\"\\\\.(coffee|scss|css|less|hbs|svg|json)$\"],\n },\n rules: {\n // Static analysis:\n\n // ensure imports point to files/modules that can be resolved\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md\n \"import/no-unresolved\": [\"error\", { commonjs: true, caseSensitive: true }],\n\n // ensure named imports coupled with named exports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md#when-not-to-use-it\n \"import/named\": \"error\",\n\n // ensure default import coupled with default export\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/default.md#when-not-to-use-it\n \"import/default\": \"off\",\n\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/namespace.md\n \"import/namespace\": \"off\",\n\n // Helpful warnings:\n\n // disallow invalid exports, e.g. multiple defaults\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/export.md\n \"import/export\": \"error\",\n\n // do not allow a default import name to match a named export\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default.md\n \"import/no-named-as-default\": \"error\",\n\n // warn on accessing default export property names that are also named exports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default-member.md\n \"import/no-named-as-default-member\": \"error\",\n\n // disallow use of jsdoc-marked-deprecated imports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-deprecated.md\n \"import/no-deprecated\": \"off\",\n\n // Forbid the use of extraneous packages\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md\n // paths are treated both as absolute paths, and relative to process.cwd()\n \"import/no-extraneous-dependencies\": [\n \"error\",\n {\n devDependencies: [\n \"test/**\", // tape, common npm pattern\n \"tests/**\", // also common npm pattern\n \"spec/**\", // mocha, rspec-like pattern\n \"**/fixture/**\", // jest pattern\n \"**/__mocks__/**\", // jest pattern\n \"test.{js,jsx}\", // repos with a single test file\n \"test-*.{js,jsx}\", // repos with multiple top-level test files\n \"**/*{.,_}{test,spec}.{js,jsx}\", // tests where the extension or filename suffix denotes that it is a test\n \"**/jest.config.cjs\", // jest config\n \"**/jest.setup.js\", // jest setup\n \"**/vue.config.cjs\", // vue-cli config\n \"**/webpack.config.cjs\", // webpack config\n \"**/webpack.config.*.js\", // webpack config\n \"**/rollup.config.cjs\", // rollup config\n \"**/rollup.config.*.js\", // rollup config\n \"**/gulpfile.js\", // gulp config\n \"**/gulpfile.*.js\", // gulp config\n \"**/Gruntfile{,.js}\", // grunt config\n \"**/protractor.conf.js\", // protractor config\n \"**/protractor.conf.*.js\", // protractor config\n \"**/karma.conf.js\", // karma config\n \"**/.eslintrc.js\", // eslint config\n \"**/.eslintrc.cjs\", // eslint config\n \"**/vite.config.js\", // vite config\n \"**/vite.config.ts\", // vite config\n \"**/vitest.config.js\", // vitest config\n \"**/vitest.config.ts\", // vitest config\n \"**/__tests__/**/*.?(c|m)[jt]s?(x)\", // vitest config test include\n \"**/?(*.){test,spec}.?(c|m)[jt]s?(x)\", // vitest config test include\n ],\n optionalDependencies: false,\n },\n ],\n\n // Forbid mutable exports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md\n \"import/no-mutable-exports\": \"error\",\n\n // Module systems:\n\n // disallow require()\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-commonjs.md\n \"import/no-commonjs\": \"off\",\n\n // disallow AMD require/define\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-amd.md\n \"import/no-amd\": \"error\",\n\n // No Node.js builtin modules\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-nodejs-modules.md\n \"import/no-nodejs-modules\": \"off\",\n\n // Style guide:\n\n // disallow non-import statements appearing before import statements\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/first.md\n \"import/first\": \"error\",\n\n // disallow non-import statements appearing before import statements\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/imports-first.md\n // deprecated: use `import/first`\n \"import/imports-first\": \"off\",\n\n // disallow duplicate imports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md\n \"import/no-duplicates\": \"error\",\n\n // disallow namespace imports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-namespace.md\n \"import/no-namespace\": \"error\",\n\n // Ensure consistent use of file extension within the import path\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md\n \"import/extensions\": [\n \"error\",\n \"ignorePackages\",\n {\n js: \"never\",\n mjs: \"never\",\n jsx: \"never\",\n },\n ],\n\n // ensure absolute imports are above relative imports and that unassigned imports are ignored\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md\n // TODO: enforce a stricter convention in module import order?\n \"import/order\": [\n \"error\",\n {\n groups: [[\"builtin\", \"external\", \"internal\"]],\n },\n ],\n\n // Require a newline after the last import/require in a group\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md\n \"import/newline-after-import\": \"error\",\n\n // Require modules with a single export to use a default export\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md\n \"import/prefer-default-export\": \"error\",\n\n // Restrict which files can be imported in a given folder\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-restricted-paths.md\n \"import/no-restricted-paths\": \"off\",\n\n // Forbid modules to have too many dependencies\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/max-dependencies.md\n \"import/max-dependencies\": [\"off\", { max: 10 }],\n\n // Forbid import of modules using absolute paths\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-absolute-path.md\n \"import/no-absolute-path\": \"error\",\n\n // Forbid require() calls with expressions\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-dynamic-require.md\n \"import/no-dynamic-require\": \"error\",\n\n // prevent importing the submodules of other modules\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-internal-modules.md\n \"import/no-internal-modules\": [\n \"off\",\n {\n allow: [],\n },\n ],\n\n // Warn if a module could be mistakenly parsed as a script by a consumer\n // leveraging Unambiguous JavaScript Grammar\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/unambiguous.md\n // this should not be enabled until this proposal has at least been *presented* to TC39.\n // At the moment, it's not a thing.\n \"import/unambiguous\": \"off\",\n\n // Forbid Webpack loader syntax in imports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md\n \"import/no-webpack-loader-syntax\": \"error\",\n\n // Prevent unassigned imports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unassigned-import.md\n // importing for side effects is perfectly acceptable, if you need side effects.\n \"import/no-unassigned-import\": \"off\",\n\n // Prevent importing the default as if it were named\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-default.md\n \"import/no-named-default\": \"error\",\n\n // Reports if a module's default export is unnamed\n // https://github.com/benmosher/eslint-plugin-import/blob/d9b712ac7fd1fddc391f7b234827925c160d956f/docs/rules/no-anonymous-default-export.md\n \"import/no-anonymous-default-export\": [\n \"off\",\n {\n allowArray: false,\n allowArrowFunction: false,\n allowAnonymousClass: false,\n allowAnonymousFunction: false,\n allowLiteral: false,\n allowObject: false,\n },\n ],\n\n // This rule enforces that all exports are declared at the bottom of the file.\n // https://github.com/benmosher/eslint-plugin-import/blob/98acd6afd04dcb6920b81330114e146dc8532ea4/docs/rules/exports-last.md\n \"import/exports-last\": \"error\",\n\n // Reports when named exports are not grouped together in a single export declaration\n // or when multiple assignments to CommonJS const config or exports object are present\n // in a single file.\n // https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/group-exports.md\n \"import/group-exports\": \"off\",\n\n // forbid default exports. this is a terrible rule, do not use it.\n // https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-default-export.md\n \"import/no-default-export\": \"off\",\n\n // Prohibit named exports. this is a terrible rule, do not use it.\n // https://github.com/benmosher/eslint-plugin-import/blob/1ec80fa35fa1819e2d35a70e68fb6a149fb57c5e/docs/rules/no-named-export.md\n \"import/no-named-export\": \"off\",\n\n // Forbid a module from importing itself\n // https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-self-import.md\n \"import/no-self-import\": \"error\",\n\n // Forbid cyclical dependencies between modules\n // https://github.com/benmosher/eslint-plugin-import/blob/d81f48a2506182738409805f5272eff4d77c9348/docs/rules/no-cycle.md\n \"import/no-cycle\": [\"error\", { maxDepth: \"∞\" }],\n\n // Ensures that there are no useless path segments\n // https://github.com/benmosher/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/no-useless-path-segments.md\n \"import/no-useless-path-segments\": [\"error\", { commonjs: true, noUselessIndex: true }],\n\n // dynamic imports require a leading comment with a webpackChunkName\n // https://github.com/benmosher/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/dynamic-import-chunkname.md\n \"import/dynamic-import-chunkname\": [\n \"off\",\n {\n importFunctions: [],\n webpackChunknameFormat: \"[0-9a-zA-Z-_/.]+\",\n },\n ],\n\n // Use this rule to prevent imports to folders in relative parent paths.\n // https://github.com/benmosher/eslint-plugin-import/blob/c34f14f67f077acd5a61b3da9c0b0de298d20059/docs/rules/no-relative-parent-imports.md\n \"import/no-relative-parent-imports\": \"off\",\n\n // Reports modules without any exports, or with unused exports\n // https://github.com/benmosher/eslint-plugin-import/blob/f63dd261809de6883b13b6b5b960e6d7f42a7813/docs/rules/no-unused-modules.md\n // Note: you must disable the base rule as it can report incorrect errors\n \"import/no-unused-modules\": \"off\",\n\n // enforce a consistent style for type specifiers (inline or top-level)\n // https://github.com/import-js/eslint-plugin-import/blob/d5fc8b670dc8e6903dbb7b0894452f60c03089f5/docs/rules/consistent-type-specifier-style.md\n // TODO, semver-major: enable (just in case)\n \"import/consistent-type-specifier-style\": [\"off\", \"prefer-inline\"],\n\n // Reports the use of empty named import blocks.\n // https://github.com/import-js/eslint-plugin-import/blob/d5fc8b670dc8e6903dbb7b0894452f60c03089f5/docs/rules/no-empty-named-blocks.md\n \"import/no-empty-named-blocks\": \"error\",\n },\n\n overrides: [\n {\n files: [\"*.ts\", \"*.tsx\", \"*.mts\", \"*.cts\"],\n rules: {\n // Disabled because of https://github.com/benmosher/eslint-plugin-import/issues/1590\n \"import/export\": \"off\",\n\n // Does not work when the TS definition exports a default const.\n \"import/default\": \"off\",\n\n // Disabled as it doesn't work with TypeScript.\n // This issue and some others: https://github.com/benmosher/eslint-plugin-import/issues/1341\n \"import/named\": \"off\",\n },\n },\n ],\n};\n\nexport default config;\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/config/plugins/import.ts"],"names":["fromRoot","hasTypescript","config","import_default"],"mappings":"AAAA,OAAS,YAAAA,EAAU,iBAAAC,MAAqB,+BAGxC,IAAMC,EAAwB,CAC1B,IAAK,CACD,IAAK,EACT,EACA,cAAe,CACX,YAAa,EACb,WAAY,QAChB,EACA,QAAS,CAAC,QAAQ,EAClB,SAAU,CACN,kBAAmB,CACf,KAAM,CACF,WAAY,CAAC,OAAQ,MAAO,OAAO,CACvC,EACA,GAAID,EACE,CACI,WAAY,CAER,eAAgB,GAChB,QAASD,EAAS,eAAe,CACrC,CACJ,EACA,CAAC,CACX,EACA,GAAIC,EAAgB,CAAE,iBAAkB,CAAE,4BAA6B,CAAC,MAAO,MAAM,CAAE,CAAE,EAAI,CAAC,EAC9F,oBAAqB,CAAC,MAAO,OAAQ,MAAM,EAC3C,sBAAuB,CAAC,EACxB,gBAAiB,CAAC,yCAAyC,CAC/D,EACA,MAAO,CAKH,uBAAwB,CAAC,QAAS,CAAE,SAAU,GAAM,cAAe,EAAK,CAAC,EAIzE,eAAgB,QAIhB,iBAAkB,MAGlB,mBAAoB,MAMpB,gBAAiB,QAIjB,6BAA8B,QAI9B,oCAAqC,QAIrC,uBAAwB,MAKxB,oCAAqC,CACjC,QACA,CACI,gBAAiB,CACb,UACA,WACA,UACA,gBACA,kBACA,gBACA,kBACA,gCACA,qBACA,mBACA,oBACA,wBACA,yBACA,uBACA,wBACA,iBACA,mBACA,qBACA,wBACA,0BACA,mBACA,kBACA,mBACA,oBACA,oBACA,sBACA,sBACA,oCACA,qCACJ,EACA,qBAAsB,EAC1B,CACJ,EAIA,4BAA6B,QAM7B,qBAAsB,MAItB,gBAAiB,QAIjB,2BAA4B,MAM5B,eAAgB,QAKhB,uBAAwB,MAIxB,uBAAwB,QAIxB,sBAAuB,QAIvB,oBAAqB,CACjB,QACA,iBACA,CACI,GAAI,QACJ,IAAK,QACL,IAAK,OACT,CACJ,EAKA,eAAgB,CACZ,QACA,CACI,OAAQ,CAAC,CAAC,UAAW,WAAY,UAAU,CAAC,CAChD,CACJ,EAIA,8BAA+B,QAI/B,+BAAgC,QAIhC,6BAA8B,MAI9B,0BAA2B,CAAC,MAAO,CAAE,IAAK,EAAG,CAAC,EAI9C,0BAA2B,QAI3B,4BAA6B,QAI7B,6BAA8B,CAC1B,MACA,CACI,MAAO,CAAC,CACZ,CACJ,EAOA,qBAAsB,MAItB,kCAAmC,QAKnC,8BAA+B,MAI/B,0BAA2B,QAI3B,qCAAsC,CAClC,MACA,CACI,WAAY,GACZ,mBAAoB,GACpB,oBAAqB,GACrB,uBAAwB,GACxB,aAAc,GACd,YAAa,EACjB,CACJ,EAIA,sBAAuB,QAMvB,uBAAwB,MAIxB,2BAA4B,MAI5B,yBAA0B,MAI1B,wBAAyB,QAKzB,kBAAmB,CAAC,QAAS,CAAE,SAAU,QAAI,CAAC,EAI9C,kCAAmC,CAAC,QAAS,CAAE,SAAU,GAAM,eAAgB,EAAK,CAAC,EAIrF,kCAAmC,CAC/B,MACA,CACI,gBAAiB,CAAC,EAClB,uBAAwB,kBAC5B,CACJ,EAIA,oCAAqC,MAKrC,2BAA4B,MAK5B,yCAA0C,CAAC,MAAO,eAAe,EAIjE,+BAAgC,OACpC,EAEA,UAAW,CACP,CACI,MAAO,CAAC,OAAQ,QAAS,QAAS,OAAO,EACzC,MAAO,CAEH,gBAAiB,MAGjB,iBAAkB,MAIlB,eAAgB,KACpB,CACJ,CACJ,CACJ,EAEOE,EAAQD","sourcesContent":["import { fromRoot, hasTypescript } from \"@anolilab/package-json-utils\";\nimport type { Linter } from \"eslint\";\n\nconst config: Linter.Config = {\n env: {\n es6: true,\n },\n parserOptions: {\n ecmaVersion: 6,\n sourceType: \"module\",\n },\n plugins: [\"import\"],\n settings: {\n \"import/resolver\": {\n node: {\n extensions: [\".mjs\", \".js\", \".json\"],\n },\n ...(hasTypescript\n ? {\n typescript: {\n // eslint-disable-next-line max-len\n alwaysTryTypes: true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`\n project: fromRoot(\"tsconfig.json\"),\n },\n }\n : {}),\n },\n ...(hasTypescript ? { \"import/parsers\": { \"@typescript-eslint/parser\": [\".ts\", \".tsx\"] } } : {}),\n \"import/extensions\": [\".js\", \".mjs\", \".jsx\"],\n \"import/core-modules\": [],\n \"import/ignore\": [\"\\\\.(coffee|scss|css|less|hbs|svg|json)$\"],\n },\n rules: {\n // Static analysis:\n\n // ensure imports point to files/modules that can be resolved\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md\n \"import/no-unresolved\": [\"error\", { commonjs: true, caseSensitive: true }],\n\n // ensure named imports coupled with named exports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md#when-not-to-use-it\n \"import/named\": \"error\",\n\n // ensure default import coupled with default export\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/default.md#when-not-to-use-it\n \"import/default\": \"off\",\n\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/namespace.md\n \"import/namespace\": \"off\",\n\n // Helpful warnings:\n\n // disallow invalid exports, e.g. multiple defaults\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/export.md\n \"import/export\": \"error\",\n\n // do not allow a default import name to match a named export\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default.md\n \"import/no-named-as-default\": \"error\",\n\n // warn on accessing default export property names that are also named exports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default-member.md\n \"import/no-named-as-default-member\": \"error\",\n\n // disallow use of jsdoc-marked-deprecated imports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-deprecated.md\n \"import/no-deprecated\": \"off\",\n\n // Forbid the use of extraneous packages\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md\n // paths are treated both as absolute paths, and relative to process.cwd()\n \"import/no-extraneous-dependencies\": [\n \"error\",\n {\n devDependencies: [\n \"test/**\", // tape, common npm pattern\n \"tests/**\", // also common npm pattern\n \"spec/**\", // mocha, rspec-like pattern\n \"**/fixture/**\", // jest pattern\n \"**/__mocks__/**\", // jest pattern\n \"test.{js,jsx}\", // repos with a single test file\n \"test-*.{js,jsx}\", // repos with multiple top-level test files\n \"**/*{.,_}{test,spec}.{js,jsx}\", // tests where the extension or filename suffix denotes that it is a test\n \"**/jest.config.cjs\", // jest config\n \"**/jest.setup.js\", // jest setup\n \"**/vue.config.cjs\", // vue-cli config\n \"**/webpack.config.cjs\", // webpack config\n \"**/webpack.config.*.js\", // webpack config\n \"**/rollup.config.cjs\", // rollup config\n \"**/rollup.config.*.js\", // rollup config\n \"**/gulpfile.js\", // gulp config\n \"**/gulpfile.*.js\", // gulp config\n \"**/Gruntfile{,.js}\", // grunt config\n \"**/protractor.conf.js\", // protractor config\n \"**/protractor.conf.*.js\", // protractor config\n \"**/karma.conf.js\", // karma config\n \"**/.eslintrc.js\", // eslint config\n \"**/.eslintrc.cjs\", // eslint config\n \"**/vite.config.js\", // vite config\n \"**/vite.config.ts\", // vite config\n \"**/vitest.config.js\", // vitest config\n \"**/vitest.config.ts\", // vitest config\n \"**/__tests__/**/*.?(c|m)[jt]s?(x)\", // vitest config test include\n \"**/?(*.){test,spec}.?(c|m)[jt]s?(x)\", // vitest config test include\n ],\n optionalDependencies: false,\n },\n ],\n\n // Forbid mutable exports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md\n \"import/no-mutable-exports\": \"error\",\n\n // Module systems:\n\n // disallow require()\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-commonjs.md\n \"import/no-commonjs\": \"off\",\n\n // disallow AMD require/define\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-amd.md\n \"import/no-amd\": \"error\",\n\n // No Node.js builtin modules\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-nodejs-modules.md\n \"import/no-nodejs-modules\": \"off\",\n\n // Style guide:\n\n // disallow non-import statements appearing before import statements\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/first.md\n \"import/first\": \"error\",\n\n // disallow non-import statements appearing before import statements\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/imports-first.md\n // deprecated: use `import/first`\n \"import/imports-first\": \"off\",\n\n // disallow duplicate imports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md\n \"import/no-duplicates\": \"error\",\n\n // disallow namespace imports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-namespace.md\n \"import/no-namespace\": \"error\",\n\n // Ensure consistent use of file extension within the import path\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md\n \"import/extensions\": [\n \"error\",\n \"ignorePackages\",\n {\n js: \"never\",\n mjs: \"never\",\n jsx: \"never\",\n },\n ],\n\n // ensure absolute imports are above relative imports and that unassigned imports are ignored\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md\n // TODO: enforce a stricter convention in module import order?\n \"import/order\": [\n \"error\",\n {\n groups: [[\"builtin\", \"external\", \"internal\"]],\n },\n ],\n\n // Require a newline after the last import/require in a group\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md\n \"import/newline-after-import\": \"error\",\n\n // Require modules with a single export to use a default export\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md\n \"import/prefer-default-export\": \"error\",\n\n // Restrict which files can be imported in a given folder\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-restricted-paths.md\n \"import/no-restricted-paths\": \"off\",\n\n // Forbid modules to have too many dependencies\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/max-dependencies.md\n \"import/max-dependencies\": [\"off\", { max: 10 }],\n\n // Forbid import of modules using absolute paths\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-absolute-path.md\n \"import/no-absolute-path\": \"error\",\n\n // Forbid require() calls with expressions\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-dynamic-require.md\n \"import/no-dynamic-require\": \"error\",\n\n // prevent importing the submodules of other modules\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-internal-modules.md\n \"import/no-internal-modules\": [\n \"off\",\n {\n allow: [],\n },\n ],\n\n // Warn if a module could be mistakenly parsed as a script by a consumer\n // leveraging Unambiguous JavaScript Grammar\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/unambiguous.md\n // this should not be enabled until this proposal has at least been *presented* to TC39.\n // At the moment, it's not a thing.\n \"import/unambiguous\": \"off\",\n\n // Forbid Webpack loader syntax in imports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md\n \"import/no-webpack-loader-syntax\": \"error\",\n\n // Prevent unassigned imports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unassigned-import.md\n // importing for side effects is perfectly acceptable, if you need side effects.\n \"import/no-unassigned-import\": \"off\",\n\n // Prevent importing the default as if it were named\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-default.md\n \"import/no-named-default\": \"error\",\n\n // Reports if a module's default export is unnamed\n // https://github.com/benmosher/eslint-plugin-import/blob/d9b712ac7fd1fddc391f7b234827925c160d956f/docs/rules/no-anonymous-default-export.md\n \"import/no-anonymous-default-export\": [\n \"off\",\n {\n allowArray: false,\n allowArrowFunction: false,\n allowAnonymousClass: false,\n allowAnonymousFunction: false,\n allowLiteral: false,\n allowObject: false,\n },\n ],\n\n // This rule enforces that all exports are declared at the bottom of the file.\n // https://github.com/benmosher/eslint-plugin-import/blob/98acd6afd04dcb6920b81330114e146dc8532ea4/docs/rules/exports-last.md\n \"import/exports-last\": \"error\",\n\n // Reports when named exports are not grouped together in a single export declaration\n // or when multiple assignments to CommonJS const config or exports object are present\n // in a single file.\n // https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/group-exports.md\n \"import/group-exports\": \"off\",\n\n // forbid default exports. this is a terrible rule, do not use it.\n // https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-default-export.md\n \"import/no-default-export\": \"off\",\n\n // Prohibit named exports. this is a terrible rule, do not use it.\n // https://github.com/benmosher/eslint-plugin-import/blob/1ec80fa35fa1819e2d35a70e68fb6a149fb57c5e/docs/rules/no-named-export.md\n \"import/no-named-export\": \"off\",\n\n // Forbid a module from importing itself\n // https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-self-import.md\n \"import/no-self-import\": \"error\",\n\n // Forbid cyclical dependencies between modules\n // https://github.com/benmosher/eslint-plugin-import/blob/d81f48a2506182738409805f5272eff4d77c9348/docs/rules/no-cycle.md\n // https://medium.com/@steven-lemon182/are-typescript-barrel-files-an-anti-pattern-72a713004250\n \"import/no-cycle\": [\"error\", { maxDepth: \"∞\" }],\n\n // Ensures that there are no useless path segments\n // https://github.com/benmosher/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/no-useless-path-segments.md\n \"import/no-useless-path-segments\": [\"error\", { commonjs: true, noUselessIndex: true }],\n\n // dynamic imports require a leading comment with a webpackChunkName\n // https://github.com/benmosher/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/dynamic-import-chunkname.md\n \"import/dynamic-import-chunkname\": [\n \"off\",\n {\n importFunctions: [],\n webpackChunknameFormat: \"[0-9a-zA-Z-_/.]+\",\n },\n ],\n\n // Use this rule to prevent imports to folders in relative parent paths.\n // https://github.com/benmosher/eslint-plugin-import/blob/c34f14f67f077acd5a61b3da9c0b0de298d20059/docs/rules/no-relative-parent-imports.md\n \"import/no-relative-parent-imports\": \"off\",\n\n // Reports modules without any exports, or with unused exports\n // https://github.com/benmosher/eslint-plugin-import/blob/f63dd261809de6883b13b6b5b960e6d7f42a7813/docs/rules/no-unused-modules.md\n // Note: you must disable the base rule as it can report incorrect errors\n \"import/no-unused-modules\": \"off\",\n\n // enforce a consistent style for type specifiers (inline or top-level)\n // https://github.com/import-js/eslint-plugin-import/blob/d5fc8b670dc8e6903dbb7b0894452f60c03089f5/docs/rules/consistent-type-specifier-style.md\n // TODO, semver-major: enable (just in case)\n \"import/consistent-type-specifier-style\": [\"off\", \"prefer-inline\"],\n\n // Reports the use of empty named import blocks.\n // https://github.com/import-js/eslint-plugin-import/blob/d5fc8b670dc8e6903dbb7b0894452f60c03089f5/docs/rules/no-empty-named-blocks.md\n \"import/no-empty-named-blocks\": \"error\",\n },\n\n overrides: [\n {\n files: [\"*.ts\", \"*.tsx\", \"*.mts\", \"*.cts\"],\n rules: {\n // Disabled because of https://github.com/benmosher/eslint-plugin-import/issues/1590\n \"import/export\": \"off\",\n\n // Does not work when the TS definition exports a default const.\n \"import/default\": \"off\",\n\n // Disabled as it doesn't work with TypeScript.\n // This issue and some others: https://github.com/benmosher/eslint-plugin-import/issues/1341\n \"import/named\": \"off\",\n },\n },\n ],\n};\n\nexport default config;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/config/plugins/import.ts"],"names":["fromRoot","hasTypescript","config","import_default"],"mappings":"AAAA,OAAS,YAAAA,EAAU,iBAAAC,MAAqB,+BAGxC,IAAMC,EAAwB,CAC1B,IAAK,CACD,IAAK,EACT,EACA,cAAe,CACX,YAAa,EACb,WAAY,QAChB,EACA,QAAS,CAAC,QAAQ,EAClB,SAAU,CACN,kBAAmB,CACf,KAAM,CACF,WAAY,CAAC,OAAQ,MAAO,OAAO,CACvC,EACA,GAAID,EACE,CACI,WAAY,CAER,eAAgB,GAChB,QAASD,EAAS,eAAe,CACrC,CACJ,EACA,CAAC,CACX,EACA,GAAIC,EAAgB,CAAE,iBAAkB,CAAE,4BAA6B,CAAC,MAAO,MAAM,CAAE,CAAE,EAAI,CAAC,EAC9F,oBAAqB,CAAC,MAAO,OAAQ,MAAM,EAC3C,sBAAuB,CAAC,EACxB,gBAAiB,CAAC,yCAAyC,CAC/D,EACA,MAAO,CAKH,uBAAwB,CAAC,QAAS,CAAE,SAAU,GAAM,cAAe,EAAK,CAAC,EAIzE,eAAgB,QAIhB,iBAAkB,MAGlB,mBAAoB,MAMpB,gBAAiB,QAIjB,6BAA8B,QAI9B,oCAAqC,QAIrC,uBAAwB,MAKxB,oCAAqC,CACjC,QACA,CACI,gBAAiB,CACb,UACA,WACA,UACA,gBACA,kBACA,gBACA,kBACA,gCACA,qBACA,mBACA,oBACA,wBACA,yBACA,uBACA,wBACA,iBACA,mBACA,qBACA,wBACA,0BACA,mBACA,kBACA,mBACA,oBACA,oBACA,sBACA,sBACA,oCACA,qCACJ,EACA,qBAAsB,EAC1B,CACJ,EAIA,4BAA6B,QAM7B,qBAAsB,MAItB,gBAAiB,QAIjB,2BAA4B,MAM5B,eAAgB,QAKhB,uBAAwB,MAIxB,uBAAwB,QAIxB,sBAAuB,QAIvB,oBAAqB,CACjB,QACA,iBACA,CACI,GAAI,QACJ,IAAK,QACL,IAAK,OACT,CACJ,EAKA,eAAgB,CACZ,QACA,CACI,OAAQ,CAAC,CAAC,UAAW,WAAY,UAAU,CAAC,CAChD,CACJ,EAIA,8BAA+B,QAI/B,+BAAgC,QAIhC,6BAA8B,MAI9B,0BAA2B,CAAC,MAAO,CAAE,IAAK,EAAG,CAAC,EAI9C,0BAA2B,QAI3B,4BAA6B,QAI7B,6BAA8B,CAC1B,MACA,CACI,MAAO,CAAC,CACZ,CACJ,EAOA,qBAAsB,MAItB,kCAAmC,QAKnC,8BAA+B,MAI/B,0BAA2B,QAI3B,qCAAsC,CAClC,MACA,CACI,WAAY,GACZ,mBAAoB,GACpB,oBAAqB,GACrB,uBAAwB,GACxB,aAAc,GACd,YAAa,EACjB,CACJ,EAIA,sBAAuB,QAMvB,uBAAwB,MAIxB,2BAA4B,MAI5B,yBAA0B,MAI1B,wBAAyB,QAIzB,kBAAmB,CAAC,QAAS,CAAE,SAAU,QAAI,CAAC,EAI9C,kCAAmC,CAAC,QAAS,CAAE,SAAU,GAAM,eAAgB,EAAK,CAAC,EAIrF,kCAAmC,CAC/B,MACA,CACI,gBAAiB,CAAC,EAClB,uBAAwB,kBAC5B,CACJ,EAIA,oCAAqC,MAKrC,2BAA4B,MAK5B,yCAA0C,CAAC,MAAO,eAAe,EAIjE,+BAAgC,OACpC,EAEA,UAAW,CACP,CACI,MAAO,CAAC,OAAQ,QAAS,QAAS,OAAO,EACzC,MAAO,CAEH,gBAAiB,MAGjB,iBAAkB,MAIlB,eAAgB,KACpB,CACJ,CACJ,CACJ,EAEOE,EAAQD","sourcesContent":["import { fromRoot, hasTypescript } from \"@anolilab/package-json-utils\";\nimport type { Linter } from \"eslint\";\n\nconst config: Linter.Config = {\n env: {\n es6: true,\n },\n parserOptions: {\n ecmaVersion: 6,\n sourceType: \"module\",\n },\n plugins: [\"import\"],\n settings: {\n \"import/resolver\": {\n node: {\n extensions: [\".mjs\", \".js\", \".json\"],\n },\n ...(hasTypescript\n ? {\n typescript: {\n // eslint-disable-next-line max-len\n alwaysTryTypes: true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`\n project: fromRoot(\"tsconfig.json\"),\n },\n }\n : {}),\n },\n ...(hasTypescript ? { \"import/parsers\": { \"@typescript-eslint/parser\": [\".ts\", \".tsx\"] } } : {}),\n \"import/extensions\": [\".js\", \".mjs\", \".jsx\"],\n \"import/core-modules\": [],\n \"import/ignore\": [\"\\\\.(coffee|scss|css|less|hbs|svg|json)$\"],\n },\n rules: {\n // Static analysis:\n\n // ensure imports point to files/modules that can be resolved\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md\n \"import/no-unresolved\": [\"error\", { commonjs: true, caseSensitive: true }],\n\n // ensure named imports coupled with named exports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md#when-not-to-use-it\n \"import/named\": \"error\",\n\n // ensure default import coupled with default export\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/default.md#when-not-to-use-it\n \"import/default\": \"off\",\n\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/namespace.md\n \"import/namespace\": \"off\",\n\n // Helpful warnings:\n\n // disallow invalid exports, e.g. multiple defaults\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/export.md\n \"import/export\": \"error\",\n\n // do not allow a default import name to match a named export\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default.md\n \"import/no-named-as-default\": \"error\",\n\n // warn on accessing default export property names that are also named exports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default-member.md\n \"import/no-named-as-default-member\": \"error\",\n\n // disallow use of jsdoc-marked-deprecated imports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-deprecated.md\n \"import/no-deprecated\": \"off\",\n\n // Forbid the use of extraneous packages\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md\n // paths are treated both as absolute paths, and relative to process.cwd()\n \"import/no-extraneous-dependencies\": [\n \"error\",\n {\n devDependencies: [\n \"test/**\", // tape, common npm pattern\n \"tests/**\", // also common npm pattern\n \"spec/**\", // mocha, rspec-like pattern\n \"**/fixture/**\", // jest pattern\n \"**/__mocks__/**\", // jest pattern\n \"test.{js,jsx}\", // repos with a single test file\n \"test-*.{js,jsx}\", // repos with multiple top-level test files\n \"**/*{.,_}{test,spec}.{js,jsx}\", // tests where the extension or filename suffix denotes that it is a test\n \"**/jest.config.cjs\", // jest config\n \"**/jest.setup.js\", // jest setup\n \"**/vue.config.cjs\", // vue-cli config\n \"**/webpack.config.cjs\", // webpack config\n \"**/webpack.config.*.js\", // webpack config\n \"**/rollup.config.cjs\", // rollup config\n \"**/rollup.config.*.js\", // rollup config\n \"**/gulpfile.js\", // gulp config\n \"**/gulpfile.*.js\", // gulp config\n \"**/Gruntfile{,.js}\", // grunt config\n \"**/protractor.conf.js\", // protractor config\n \"**/protractor.conf.*.js\", // protractor config\n \"**/karma.conf.js\", // karma config\n \"**/.eslintrc.js\", // eslint config\n \"**/.eslintrc.cjs\", // eslint config\n \"**/vite.config.js\", // vite config\n \"**/vite.config.ts\", // vite config\n \"**/vitest.config.js\", // vitest config\n \"**/vitest.config.ts\", // vitest config\n \"**/__tests__/**/*.?(c|m)[jt]s?(x)\", // vitest config test include\n \"**/?(*.){test,spec}.?(c|m)[jt]s?(x)\", // vitest config test include\n ],\n optionalDependencies: false,\n },\n ],\n\n // Forbid mutable exports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md\n \"import/no-mutable-exports\": \"error\",\n\n // Module systems:\n\n // disallow require()\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-commonjs.md\n \"import/no-commonjs\": \"off\",\n\n // disallow AMD require/define\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-amd.md\n \"import/no-amd\": \"error\",\n\n // No Node.js builtin modules\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-nodejs-modules.md\n \"import/no-nodejs-modules\": \"off\",\n\n // Style guide:\n\n // disallow non-import statements appearing before import statements\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/first.md\n \"import/first\": \"error\",\n\n // disallow non-import statements appearing before import statements\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/imports-first.md\n // deprecated: use `import/first`\n \"import/imports-first\": \"off\",\n\n // disallow duplicate imports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md\n \"import/no-duplicates\": \"error\",\n\n // disallow namespace imports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-namespace.md\n \"import/no-namespace\": \"error\",\n\n // Ensure consistent use of file extension within the import path\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md\n \"import/extensions\": [\n \"error\",\n \"ignorePackages\",\n {\n js: \"never\",\n mjs: \"never\",\n jsx: \"never\",\n },\n ],\n\n // ensure absolute imports are above relative imports and that unassigned imports are ignored\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md\n // TODO: enforce a stricter convention in module import order?\n \"import/order\": [\n \"error\",\n {\n groups: [[\"builtin\", \"external\", \"internal\"]],\n },\n ],\n\n // Require a newline after the last import/require in a group\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md\n \"import/newline-after-import\": \"error\",\n\n // Require modules with a single export to use a default export\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md\n \"import/prefer-default-export\": \"error\",\n\n // Restrict which files can be imported in a given folder\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-restricted-paths.md\n \"import/no-restricted-paths\": \"off\",\n\n // Forbid modules to have too many dependencies\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/max-dependencies.md\n \"import/max-dependencies\": [\"off\", { max: 10 }],\n\n // Forbid import of modules using absolute paths\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-absolute-path.md\n \"import/no-absolute-path\": \"error\",\n\n // Forbid require() calls with expressions\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-dynamic-require.md\n \"import/no-dynamic-require\": \"error\",\n\n // prevent importing the submodules of other modules\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-internal-modules.md\n \"import/no-internal-modules\": [\n \"off\",\n {\n allow: [],\n },\n ],\n\n // Warn if a module could be mistakenly parsed as a script by a consumer\n // leveraging Unambiguous JavaScript Grammar\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/unambiguous.md\n // this should not be enabled until this proposal has at least been *presented* to TC39.\n // At the moment, it's not a thing.\n \"import/unambiguous\": \"off\",\n\n // Forbid Webpack loader syntax in imports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md\n \"import/no-webpack-loader-syntax\": \"error\",\n\n // Prevent unassigned imports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unassigned-import.md\n // importing for side effects is perfectly acceptable, if you need side effects.\n \"import/no-unassigned-import\": \"off\",\n\n // Prevent importing the default as if it were named\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-default.md\n \"import/no-named-default\": \"error\",\n\n // Reports if a module's default export is unnamed\n // https://github.com/benmosher/eslint-plugin-import/blob/d9b712ac7fd1fddc391f7b234827925c160d956f/docs/rules/no-anonymous-default-export.md\n \"import/no-anonymous-default-export\": [\n \"off\",\n {\n allowArray: false,\n allowArrowFunction: false,\n allowAnonymousClass: false,\n allowAnonymousFunction: false,\n allowLiteral: false,\n allowObject: false,\n },\n ],\n\n // This rule enforces that all exports are declared at the bottom of the file.\n // https://github.com/benmosher/eslint-plugin-import/blob/98acd6afd04dcb6920b81330114e146dc8532ea4/docs/rules/exports-last.md\n \"import/exports-last\": \"error\",\n\n // Reports when named exports are not grouped together in a single export declaration\n // or when multiple assignments to CommonJS const config or exports object are present\n // in a single file.\n // https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/group-exports.md\n \"import/group-exports\": \"off\",\n\n // forbid default exports. this is a terrible rule, do not use it.\n // https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-default-export.md\n \"import/no-default-export\": \"off\",\n\n // Prohibit named exports. this is a terrible rule, do not use it.\n // https://github.com/benmosher/eslint-plugin-import/blob/1ec80fa35fa1819e2d35a70e68fb6a149fb57c5e/docs/rules/no-named-export.md\n \"import/no-named-export\": \"off\",\n\n // Forbid a module from importing itself\n // https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-self-import.md\n \"import/no-self-import\": \"error\",\n\n // Forbid cyclical dependencies between modules\n // https://github.com/benmosher/eslint-plugin-import/blob/d81f48a2506182738409805f5272eff4d77c9348/docs/rules/no-cycle.md\n \"import/no-cycle\": [\"error\", { maxDepth: \"∞\" }],\n\n // Ensures that there are no useless path segments\n // https://github.com/benmosher/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/no-useless-path-segments.md\n \"import/no-useless-path-segments\": [\"error\", { commonjs: true, noUselessIndex: true }],\n\n // dynamic imports require a leading comment with a webpackChunkName\n // https://github.com/benmosher/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/dynamic-import-chunkname.md\n \"import/dynamic-import-chunkname\": [\n \"off\",\n {\n importFunctions: [],\n webpackChunknameFormat: \"[0-9a-zA-Z-_/.]+\",\n },\n ],\n\n // Use this rule to prevent imports to folders in relative parent paths.\n // https://github.com/benmosher/eslint-plugin-import/blob/c34f14f67f077acd5a61b3da9c0b0de298d20059/docs/rules/no-relative-parent-imports.md\n \"import/no-relative-parent-imports\": \"off\",\n\n // Reports modules without any exports, or with unused exports\n // https://github.com/benmosher/eslint-plugin-import/blob/f63dd261809de6883b13b6b5b960e6d7f42a7813/docs/rules/no-unused-modules.md\n // Note: you must disable the base rule as it can report incorrect errors\n \"import/no-unused-modules\": \"off\",\n\n // enforce a consistent style for type specifiers (inline or top-level)\n // https://github.com/import-js/eslint-plugin-import/blob/d5fc8b670dc8e6903dbb7b0894452f60c03089f5/docs/rules/consistent-type-specifier-style.md\n // TODO, semver-major: enable (just in case)\n \"import/consistent-type-specifier-style\": [\"off\", \"prefer-inline\"],\n\n // Reports the use of empty named import blocks.\n // https://github.com/import-js/eslint-plugin-import/blob/d5fc8b670dc8e6903dbb7b0894452f60c03089f5/docs/rules/no-empty-named-blocks.md\n \"import/no-empty-named-blocks\": \"error\",\n },\n\n overrides: [\n {\n files: [\"*.ts\", \"*.tsx\", \"*.mts\", \"*.cts\"],\n rules: {\n // Disabled because of https://github.com/benmosher/eslint-plugin-import/issues/1590\n \"import/export\": \"off\",\n\n // Does not work when the TS definition exports a default const.\n \"import/default\": \"off\",\n\n // Disabled as it doesn't work with TypeScript.\n // This issue and some others: https://github.com/benmosher/eslint-plugin-import/issues/1341\n \"import/named\": \"off\",\n },\n },\n ],\n};\n\nexport default config;\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/config/plugins/import.ts"],"names":["fromRoot","hasTypescript","config","import_default"],"mappings":"AAAA,OAAS,YAAAA,EAAU,iBAAAC,MAAqB,+BAGxC,IAAMC,EAAwB,CAC1B,IAAK,CACD,IAAK,EACT,EACA,cAAe,CACX,YAAa,EACb,WAAY,QAChB,EACA,QAAS,CAAC,QAAQ,EAClB,SAAU,CACN,kBAAmB,CACf,KAAM,CACF,WAAY,CAAC,OAAQ,MAAO,OAAO,CACvC,EACA,GAAID,EACE,CACI,WAAY,CAER,eAAgB,GAChB,QAASD,EAAS,eAAe,CACrC,CACJ,EACA,CAAC,CACX,EACA,GAAIC,EAAgB,CAAE,iBAAkB,CAAE,4BAA6B,CAAC,MAAO,MAAM,CAAE,CAAE,EAAI,CAAC,EAC9F,oBAAqB,CAAC,MAAO,OAAQ,MAAM,EAC3C,sBAAuB,CAAC,EACxB,gBAAiB,CAAC,yCAAyC,CAC/D,EACA,MAAO,CAKH,uBAAwB,CAAC,QAAS,CAAE,SAAU,GAAM,cAAe,EAAK,CAAC,EAIzE,eAAgB,QAIhB,iBAAkB,MAGlB,mBAAoB,MAMpB,gBAAiB,QAIjB,6BAA8B,QAI9B,oCAAqC,QAIrC,uBAAwB,MAKxB,oCAAqC,CACjC,QACA,CACI,gBAAiB,CACb,UACA,WACA,UACA,gBACA,kBACA,gBACA,kBACA,gCACA,qBACA,mBACA,oBACA,wBACA,yBACA,uBACA,wBACA,iBACA,mBACA,qBACA,wBACA,0BACA,mBACA,kBACA,mBACA,oBACA,oBACA,sBACA,sBACA,oCACA,qCACJ,EACA,qBAAsB,EAC1B,CACJ,EAIA,4BAA6B,QAM7B,qBAAsB,MAItB,gBAAiB,QAIjB,2BAA4B,MAM5B,eAAgB,QAKhB,uBAAwB,MAIxB,uBAAwB,QAIxB,sBAAuB,QAIvB,oBAAqB,CACjB,QACA,iBACA,CACI,GAAI,QACJ,IAAK,QACL,IAAK,OACT,CACJ,EAKA,eAAgB,CACZ,QACA,CACI,OAAQ,CAAC,CAAC,UAAW,WAAY,UAAU,CAAC,CAChD,CACJ,EAIA,8BAA+B,QAI/B,+BAAgC,QAIhC,6BAA8B,MAI9B,0BAA2B,CAAC,MAAO,CAAE,IAAK,EAAG,CAAC,EAI9C,0BAA2B,QAI3B,4BAA6B,QAI7B,6BAA8B,CAC1B,MACA,CACI,MAAO,CAAC,CACZ,CACJ,EAOA,qBAAsB,MAItB,kCAAmC,QAKnC,8BAA+B,MAI/B,0BAA2B,QAI3B,qCAAsC,CAClC,MACA,CACI,WAAY,GACZ,mBAAoB,GACpB,oBAAqB,GACrB,uBAAwB,GACxB,aAAc,GACd,YAAa,EACjB,CACJ,EAIA,sBAAuB,QAMvB,uBAAwB,MAIxB,2BAA4B,MAI5B,yBAA0B,MAI1B,wBAAyB,QAKzB,kBAAmB,CAAC,QAAS,CAAE,SAAU,QAAI,CAAC,EAI9C,kCAAmC,CAAC,QAAS,CAAE,SAAU,GAAM,eAAgB,EAAK,CAAC,EAIrF,kCAAmC,CAC/B,MACA,CACI,gBAAiB,CAAC,EAClB,uBAAwB,kBAC5B,CACJ,EAIA,oCAAqC,MAKrC,2BAA4B,MAK5B,yCAA0C,CAAC,MAAO,eAAe,EAIjE,+BAAgC,OACpC,EAEA,UAAW,CACP,CACI,MAAO,CAAC,OAAQ,QAAS,QAAS,OAAO,EACzC,MAAO,CAEH,gBAAiB,MAGjB,iBAAkB,MAIlB,eAAgB,KACpB,CACJ,CACJ,CACJ,EAEOE,EAAQD","sourcesContent":["import { fromRoot, hasTypescript } from \"@anolilab/package-json-utils\";\nimport type { Linter } from \"eslint\";\n\nconst config: Linter.Config = {\n env: {\n es6: true,\n },\n parserOptions: {\n ecmaVersion: 6,\n sourceType: \"module\",\n },\n plugins: [\"import\"],\n settings: {\n \"import/resolver\": {\n node: {\n extensions: [\".mjs\", \".js\", \".json\"],\n },\n ...(hasTypescript\n ? {\n typescript: {\n // eslint-disable-next-line max-len\n alwaysTryTypes: true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`\n project: fromRoot(\"tsconfig.json\"),\n },\n }\n : {}),\n },\n ...(hasTypescript ? { \"import/parsers\": { \"@typescript-eslint/parser\": [\".ts\", \".tsx\"] } } : {}),\n \"import/extensions\": [\".js\", \".mjs\", \".jsx\"],\n \"import/core-modules\": [],\n \"import/ignore\": [\"\\\\.(coffee|scss|css|less|hbs|svg|json)$\"],\n },\n rules: {\n // Static analysis:\n\n // ensure imports point to files/modules that can be resolved\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md\n \"import/no-unresolved\": [\"error\", { commonjs: true, caseSensitive: true }],\n\n // ensure named imports coupled with named exports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md#when-not-to-use-it\n \"import/named\": \"error\",\n\n // ensure default import coupled with default export\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/default.md#when-not-to-use-it\n \"import/default\": \"off\",\n\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/namespace.md\n \"import/namespace\": \"off\",\n\n // Helpful warnings:\n\n // disallow invalid exports, e.g. multiple defaults\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/export.md\n \"import/export\": \"error\",\n\n // do not allow a default import name to match a named export\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default.md\n \"import/no-named-as-default\": \"error\",\n\n // warn on accessing default export property names that are also named exports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default-member.md\n \"import/no-named-as-default-member\": \"error\",\n\n // disallow use of jsdoc-marked-deprecated imports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-deprecated.md\n \"import/no-deprecated\": \"off\",\n\n // Forbid the use of extraneous packages\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md\n // paths are treated both as absolute paths, and relative to process.cwd()\n \"import/no-extraneous-dependencies\": [\n \"error\",\n {\n devDependencies: [\n \"test/**\", // tape, common npm pattern\n \"tests/**\", // also common npm pattern\n \"spec/**\", // mocha, rspec-like pattern\n \"**/fixture/**\", // jest pattern\n \"**/__mocks__/**\", // jest pattern\n \"test.{js,jsx}\", // repos with a single test file\n \"test-*.{js,jsx}\", // repos with multiple top-level test files\n \"**/*{.,_}{test,spec}.{js,jsx}\", // tests where the extension or filename suffix denotes that it is a test\n \"**/jest.config.cjs\", // jest config\n \"**/jest.setup.js\", // jest setup\n \"**/vue.config.cjs\", // vue-cli config\n \"**/webpack.config.cjs\", // webpack config\n \"**/webpack.config.*.js\", // webpack config\n \"**/rollup.config.cjs\", // rollup config\n \"**/rollup.config.*.js\", // rollup config\n \"**/gulpfile.js\", // gulp config\n \"**/gulpfile.*.js\", // gulp config\n \"**/Gruntfile{,.js}\", // grunt config\n \"**/protractor.conf.js\", // protractor config\n \"**/protractor.conf.*.js\", // protractor config\n \"**/karma.conf.js\", // karma config\n \"**/.eslintrc.js\", // eslint config\n \"**/.eslintrc.cjs\", // eslint config\n \"**/vite.config.js\", // vite config\n \"**/vite.config.ts\", // vite config\n \"**/vitest.config.js\", // vitest config\n \"**/vitest.config.ts\", // vitest config\n \"**/__tests__/**/*.?(c|m)[jt]s?(x)\", // vitest config test include\n \"**/?(*.){test,spec}.?(c|m)[jt]s?(x)\", // vitest config test include\n ],\n optionalDependencies: false,\n },\n ],\n\n // Forbid mutable exports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md\n \"import/no-mutable-exports\": \"error\",\n\n // Module systems:\n\n // disallow require()\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-commonjs.md\n \"import/no-commonjs\": \"off\",\n\n // disallow AMD require/define\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-amd.md\n \"import/no-amd\": \"error\",\n\n // No Node.js builtin modules\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-nodejs-modules.md\n \"import/no-nodejs-modules\": \"off\",\n\n // Style guide:\n\n // disallow non-import statements appearing before import statements\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/first.md\n \"import/first\": \"error\",\n\n // disallow non-import statements appearing before import statements\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/imports-first.md\n // deprecated: use `import/first`\n \"import/imports-first\": \"off\",\n\n // disallow duplicate imports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md\n \"import/no-duplicates\": \"error\",\n\n // disallow namespace imports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-namespace.md\n \"import/no-namespace\": \"error\",\n\n // Ensure consistent use of file extension within the import path\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md\n \"import/extensions\": [\n \"error\",\n \"ignorePackages\",\n {\n js: \"never\",\n mjs: \"never\",\n jsx: \"never\",\n },\n ],\n\n // ensure absolute imports are above relative imports and that unassigned imports are ignored\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md\n // TODO: enforce a stricter convention in module import order?\n \"import/order\": [\n \"error\",\n {\n groups: [[\"builtin\", \"external\", \"internal\"]],\n },\n ],\n\n // Require a newline after the last import/require in a group\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md\n \"import/newline-after-import\": \"error\",\n\n // Require modules with a single export to use a default export\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md\n \"import/prefer-default-export\": \"error\",\n\n // Restrict which files can be imported in a given folder\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-restricted-paths.md\n \"import/no-restricted-paths\": \"off\",\n\n // Forbid modules to have too many dependencies\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/max-dependencies.md\n \"import/max-dependencies\": [\"off\", { max: 10 }],\n\n // Forbid import of modules using absolute paths\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-absolute-path.md\n \"import/no-absolute-path\": \"error\",\n\n // Forbid require() calls with expressions\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-dynamic-require.md\n \"import/no-dynamic-require\": \"error\",\n\n // prevent importing the submodules of other modules\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-internal-modules.md\n \"import/no-internal-modules\": [\n \"off\",\n {\n allow: [],\n },\n ],\n\n // Warn if a module could be mistakenly parsed as a script by a consumer\n // leveraging Unambiguous JavaScript Grammar\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/unambiguous.md\n // this should not be enabled until this proposal has at least been *presented* to TC39.\n // At the moment, it's not a thing.\n \"import/unambiguous\": \"off\",\n\n // Forbid Webpack loader syntax in imports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md\n \"import/no-webpack-loader-syntax\": \"error\",\n\n // Prevent unassigned imports\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unassigned-import.md\n // importing for side effects is perfectly acceptable, if you need side effects.\n \"import/no-unassigned-import\": \"off\",\n\n // Prevent importing the default as if it were named\n // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-default.md\n \"import/no-named-default\": \"error\",\n\n // Reports if a module's default export is unnamed\n // https://github.com/benmosher/eslint-plugin-import/blob/d9b712ac7fd1fddc391f7b234827925c160d956f/docs/rules/no-anonymous-default-export.md\n \"import/no-anonymous-default-export\": [\n \"off\",\n {\n allowArray: false,\n allowArrowFunction: false,\n allowAnonymousClass: false,\n allowAnonymousFunction: false,\n allowLiteral: false,\n allowObject: false,\n },\n ],\n\n // This rule enforces that all exports are declared at the bottom of the file.\n // https://github.com/benmosher/eslint-plugin-import/blob/98acd6afd04dcb6920b81330114e146dc8532ea4/docs/rules/exports-last.md\n \"import/exports-last\": \"error\",\n\n // Reports when named exports are not grouped together in a single export declaration\n // or when multiple assignments to CommonJS const config or exports object are present\n // in a single file.\n // https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/group-exports.md\n \"import/group-exports\": \"off\",\n\n // forbid default exports. this is a terrible rule, do not use it.\n // https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-default-export.md\n \"import/no-default-export\": \"off\",\n\n // Prohibit named exports. this is a terrible rule, do not use it.\n // https://github.com/benmosher/eslint-plugin-import/blob/1ec80fa35fa1819e2d35a70e68fb6a149fb57c5e/docs/rules/no-named-export.md\n \"import/no-named-export\": \"off\",\n\n // Forbid a module from importing itself\n // https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-self-import.md\n \"import/no-self-import\": \"error\",\n\n // Forbid cyclical dependencies between modules\n // https://github.com/benmosher/eslint-plugin-import/blob/d81f48a2506182738409805f5272eff4d77c9348/docs/rules/no-cycle.md\n // https://medium.com/@steven-lemon182/are-typescript-barrel-files-an-anti-pattern-72a713004250\n \"import/no-cycle\": [\"error\", { maxDepth: \"∞\" }],\n\n // Ensures that there are no useless path segments\n // https://github.com/benmosher/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/no-useless-path-segments.md\n \"import/no-useless-path-segments\": [\"error\", { commonjs: true, noUselessIndex: true }],\n\n // dynamic imports require a leading comment with a webpackChunkName\n // https://github.com/benmosher/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/dynamic-import-chunkname.md\n \"import/dynamic-import-chunkname\": [\n \"off\",\n {\n importFunctions: [],\n webpackChunknameFormat: \"[0-9a-zA-Z-_/.]+\",\n },\n ],\n\n // Use this rule to prevent imports to folders in relative parent paths.\n // https://github.com/benmosher/eslint-plugin-import/blob/c34f14f67f077acd5a61b3da9c0b0de298d20059/docs/rules/no-relative-parent-imports.md\n \"import/no-relative-parent-imports\": \"off\",\n\n // Reports modules without any exports, or with unused exports\n // https://github.com/benmosher/eslint-plugin-import/blob/f63dd261809de6883b13b6b5b960e6d7f42a7813/docs/rules/no-unused-modules.md\n // Note: you must disable the base rule as it can report incorrect errors\n \"import/no-unused-modules\": \"off\",\n\n // enforce a consistent style for type specifiers (inline or top-level)\n // https://github.com/import-js/eslint-plugin-import/blob/d5fc8b670dc8e6903dbb7b0894452f60c03089f5/docs/rules/consistent-type-specifier-style.md\n // TODO, semver-major: enable (just in case)\n \"import/consistent-type-specifier-style\": [\"off\", \"prefer-inline\"],\n\n // Reports the use of empty named import blocks.\n // https://github.com/import-js/eslint-plugin-import/blob/d5fc8b670dc8e6903dbb7b0894452f60c03089f5/docs/rules/no-empty-named-blocks.md\n \"import/no-empty-named-blocks\": \"error\",\n },\n\n overrides: [\n {\n files: [\"*.ts\", \"*.tsx\", \"*.mts\", \"*.cts\"],\n rules: {\n // Disabled because of https://github.com/benmosher/eslint-plugin-import/issues/1590\n \"import/export\": \"off\",\n\n // Does not work when the TS definition exports a default const.\n \"import/default\": \"off\",\n\n // Disabled as it doesn't work with TypeScript.\n // This issue and some others: https://github.com/benmosher/eslint-plugin-import/issues/1341\n \"import/named\": \"off\",\n },\n },\n ],\n};\n\nexport default config;\n"]}
|