Skip to content

Commit 2e6e827

Browse files
committed
Disable more rules for config files
1 parent 070b262 commit 2e6e827

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ This applies to file paths matching any of the following globs:
115115
- `**/testing-utils/**/*.?(c|m)[jt]s?(x)`
116116
- `**/test-utils/**/*.?(c|m)[jt]s?(x)`
117117
- `**/fixtures/**/*.?(c|m)[jt]s?(x)`
118+
- `*.config.?(c|m)[jt]s`
119+
- `.prettierrc.?(c|m)[jt]s`
120+
- `codegen.?(c|m)[jt]s`
118121

119122
<!-- end autogenerated -->
120123

index.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const {
22
TEST_FILE_PATTERNS,
33
GENERATED_FILE_PATTERNS,
4-
KNOWN_CONFIG_FILE_PATTERNS,
4+
CONFIG_FILE_PATTERNS,
55
} = require('./lib/patterns');
66
const { packageExists } = require('./lib/utils');
77
const unicorn = require('eslint-plugin-unicorn');
@@ -173,15 +173,21 @@ module.exports = {
173173
},
174174

175175
{
176-
files: KNOWN_CONFIG_FILE_PATTERNS,
176+
files: CONFIG_FILE_PATTERNS,
177177
rules: {
178+
// DISABLED RULES FOR CONFIG FILES
179+
178180
'import/no-anonymous-default-export': 'off',
181+
'unicorn/no-abusive-eslint-disable': 'off',
182+
'unicorn/prefer-module': 'off',
179183
},
180184
},
181185

182186
{
183-
files: [...GENERATED_FILE_PATTERNS, ...KNOWN_CONFIG_FILE_PATTERNS],
187+
files: GENERATED_FILE_PATTERNS,
184188
rules: {
189+
// DISABLED RULES FOR GENERATED FILES
190+
185191
'unicorn/no-abusive-eslint-disable': 'off',
186192
},
187193
},

lib/patterns.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ const withExtensions = (patterns, options = {}) =>
1414
pattern => `${pattern}.?(c|m)[jt]s${options.skipJSX ? '' : `?(x)`}`,
1515
);
1616

17+
const CONFIG_FILE_PATTERNS = withExtensions(
18+
['*.config', '.prettierrc', 'codegen'],
19+
{ skipJSX: true },
20+
);
21+
1722
const UNIT_TEST_FILE_PATTERNS = withExtensions([
1823
fromSuffix('spec'),
1924
fromSuffix('test'),
@@ -36,6 +41,7 @@ const TEST_FILE_PATTERNS = [
3641
fromDirectory('test-utils'),
3742
fromDirectory('fixtures'),
3843
]),
44+
...CONFIG_FILE_PATTERNS,
3945
];
4046

4147
// @angular-eslint's inline templates processor transforms .ts files to .html
@@ -61,11 +67,6 @@ const GENERATED_FILE_PATTERNS = withExtensions([
6167
'generated',
6268
]);
6369

64-
const KNOWN_CONFIG_FILE_PATTERNS = withExtensions(
65-
['jest.config', 'vite.config'],
66-
{ skipJSX: true },
67-
);
68-
6970
module.exports = {
7071
TEST_FILE_PATTERNS,
7172
TEST_FILE_PATTERNS_INLINE_TEMPLATES,
@@ -77,5 +78,5 @@ module.exports = {
7778
GRAPHQL_FILE_PATTERN,
7879
STORYBOOK_FILE_PATTERNS,
7980
GENERATED_FILE_PATTERNS,
80-
KNOWN_CONFIG_FILE_PATTERNS,
81+
CONFIG_FILE_PATTERNS,
8182
};

0 commit comments

Comments
 (0)