|
1 | 1 | // ! This file is here for testing `no-unused-modules` rule for eslintrc |
2 | 2 |
|
3 | | -const { version } = require('eslint/package.json') |
4 | | - |
5 | | -const noEslintrc = +version.split('.')[0] > 8 |
6 | | - |
7 | | -const testCompiled = process.env.TEST_COMPILED === '1' |
8 | | - |
9 | | -/** @type {import('eslint').Linter.Config} */ |
10 | | -module.exports = { |
11 | | - root: true, |
12 | | - reportUnusedDisableDirectives: true, |
13 | | - extends: [ |
14 | | - 'eslint:recommended', |
15 | | - 'plugin:@typescript-eslint/recommended', |
16 | | - 'plugin:eslint-plugin/recommended', |
17 | | - testCompiled && 'plugin:import-x/recommended', |
18 | | - 'plugin:json/recommended-legacy', |
19 | | - 'plugin:mdx/recommended', |
20 | | - 'plugin:n/recommended', |
21 | | - !noEslintrc && 'plugin:unicorn/recommended', |
22 | | - 'plugin:yml/standard', |
23 | | - 'plugin:yml/prettier', |
24 | | - 'plugin:prettier/recommended', |
25 | | - ].filter(Boolean), |
26 | | - env: { |
27 | | - node: true, |
28 | | - es6: true, |
29 | | - es2017: true, |
30 | | - }, |
31 | | - parserOptions: { |
32 | | - sourceType: 'module', |
33 | | - ecmaVersion: 2020, |
34 | | - }, |
35 | | - rules: { |
36 | | - '@typescript-eslint/no-non-null-assertion': 'off', |
37 | | - '@typescript-eslint/no-require-imports': 'off', |
38 | | - |
39 | | - 'no-constant-condition': noEslintrc ? 'error' : 'off', |
40 | | - |
41 | | - 'eslint-plugin/consistent-output': ['error', 'always'], |
42 | | - 'eslint-plugin/meta-property-ordering': 'error', |
43 | | - 'eslint-plugin/no-deprecated-context-methods': 'error', |
44 | | - 'eslint-plugin/no-deprecated-report-api': 'off', |
45 | | - 'eslint-plugin/prefer-replace-text': 'error', |
46 | | - 'eslint-plugin/report-message-format': 'error', |
47 | | - 'eslint-plugin/require-meta-docs-description': [ |
48 | | - 'error', |
49 | | - { pattern: String.raw`^(Enforce|Ensure|Prefer|Forbid).+\.$` }, |
50 | | - ], |
51 | | - 'eslint-plugin/require-meta-schema': 'error', |
52 | | - 'eslint-plugin/require-meta-type': 'error', |
53 | | - 'n/no-extraneous-require': 'off', |
54 | | - 'n/no-missing-import': 'off', |
55 | | - 'n/no-missing-require': 'off', |
56 | | - 'n/no-unsupported-features/es-syntax': 'off', |
57 | | - ...(noEslintrc || { |
58 | | - 'unicorn/filename-case': [ |
59 | | - 'error', |
60 | | - { |
61 | | - case: 'kebabCase', |
62 | | - ignore: [String.raw`^(CONTRIBUTING|README)\.md$`], |
63 | | - }, |
64 | | - ], |
65 | | - }), |
66 | | - 'unicorn/no-array-callback-reference': 'off', |
67 | | - 'unicorn/no-array-reduce': 'off', |
68 | | - 'unicorn/no-null': 'off', |
69 | | - 'unicorn/prefer-module': 'off', |
70 | | - 'unicorn/prevent-abbreviations': 'off', |
71 | | - 'unicorn/prefer-at': 'off', |
72 | | - 'unicorn/prefer-export-from': ['error', { ignoreUsedVariables: true }], |
73 | | - |
74 | | - // dog fooding |
75 | | - ...(testCompiled && { |
76 | | - 'import-x/no-extraneous-dependencies': [ |
77 | | - 'error', |
78 | | - { |
79 | | - devDependencies: ['test/**'], |
80 | | - optionalDependencies: false, |
81 | | - peerDependencies: true, |
82 | | - bundledDependencies: false, |
83 | | - }, |
84 | | - ], |
85 | | - 'import-x/unambiguous': 'off', |
86 | | - }), |
87 | | - }, |
88 | | - |
89 | | - overrides: [ |
90 | | - { |
91 | | - files: ['*.ts'], |
92 | | - excludedFiles: ['test/fixtures'], |
93 | | - rules: { |
94 | | - '@typescript-eslint/array-type': [ |
95 | | - 2, |
96 | | - { |
97 | | - default: 'array-simple', |
98 | | - }, |
99 | | - ], |
100 | | - '@typescript-eslint/consistent-type-definitions': ['error', 'type'], |
101 | | - '@typescript-eslint/consistent-type-imports': [ |
102 | | - 'error', |
103 | | - { |
104 | | - fixStyle: 'inline-type-imports', |
105 | | - }, |
106 | | - ], |
107 | | - '@typescript-eslint/no-unused-vars': [ |
108 | | - 'error', |
109 | | - { |
110 | | - argsIgnorePattern: '^_', |
111 | | - varsIgnorePattern: '^_', |
112 | | - }, |
113 | | - ], |
114 | | - ...(testCompiled && { |
115 | | - 'import-x/consistent-type-specifier-style': 'error', |
116 | | - 'import-x/order': [ |
117 | | - 'error', |
118 | | - { |
119 | | - alphabetize: { |
120 | | - order: 'asc', |
121 | | - }, |
122 | | - 'newlines-between': 'always', |
123 | | - }, |
124 | | - ], |
125 | | - }), |
126 | | - }, |
127 | | - settings: { |
128 | | - 'import-x/resolver': { |
129 | | - typescript: { |
130 | | - project: 'tsconfig.base.json', |
131 | | - }, |
132 | | - }, |
133 | | - }, |
134 | | - }, |
135 | | - { |
136 | | - files: 'test/**', |
137 | | - env: { |
138 | | - jest: true, |
139 | | - }, |
140 | | - }, |
141 | | - { |
142 | | - files: 'global.d.ts', |
143 | | - rules: { |
144 | | - 'import-x/no-extraneous-dependencies': 'off', |
145 | | - }, |
146 | | - }, |
147 | | - { |
148 | | - files: 'README.md', |
149 | | - rules: { |
150 | | - // https://github.com/bmish/eslint-doc-generator/issues/655 |
151 | | - 'no-irregular-whitespace': 'off', |
152 | | - }, |
153 | | - }, |
154 | | - ], |
155 | | -} |
| 3 | +module.exports = {} |
0 commit comments