forked from carbon-design-system/carbon
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
147 lines (132 loc) · 4.42 KB
/
eslint.config.mjs
File metadata and controls
147 lines (132 loc) · 4.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
// @ts-check
import eslint from '@eslint/js';
import globals from 'globals';
import tseslint from 'typescript-eslint';
// TODO: There is an `eslintConfig` reference in `package.json`. Investigate
// whether it should be moved to this file or deleted.
// https://github.com/carbon-design-system/carbon/issues/18991
export default tseslint.config([
eslint.configs.recommended,
tseslint.configs.strict,
{
languageOptions: {
globals: {
...globals.browser,
...globals.jest,
...globals.node,
},
},
rules: {
// All of these rules have directives in the codebase that disable them,
// which implies that they were set previously.
'no-console': 'error',
'no-template-curly-in-string': 'error',
'prefer-arrow-callback': 'error',
'require-atomic-updates': 'error',
},
},
{
files: [
'**/tasks/**',
'actions/**',
'packages/cli/**',
'packages/upgrade/**',
],
rules: {
'no-console': 'off',
},
},
{
files: ['**/*.js'],
rules: {
'@typescript-eslint/no-require-imports': 'off',
},
},
{
// TODO: Should we ignore all files in the .gitignore? If so, handle the
// nested .gitignore files too.
ignores: [
// Build folders
'**/build/',
'**/es/',
'**/es-custom/',
'**/lib/',
'**/dist/',
'**/umd/',
'node_modules',
'packages/*/examples/*',
// Components
'packages/components/demo/*.css',
'packages/components/demo/*.map',
'packages/components/demo/*.js',
'packages/components/demo/js/prism.js',
'packages/components/demo/hot',
'!packages/components/demo/index.js', // This negation might need manual handling
'packages/components/dist',
'packages/components/tests/a11y-results',
'packages/components/tests/coverage',
'packages/components/es',
'packages/components/umd',
'packages/components/scripts',
'packages/components/css',
'packages/components/scss',
'packages/components/html',
'packages/components/docs/js',
'packages/components/node_modules',
'packages/components/scss/globals/vendor/**',
'packages/components/src/globals/scss/vendor/**',
// Upgrade
'**/__testfixtures__/**',
'packages/upgrade/cli.js',
'packages/upgrade/fixtures/sample-project/example-imports-to-unified-package.js',
// React
'**/storybook-static/**',
'packages/react/icons/index.js',
'packages/react/icons/index.esm.js',
// Icons React
'packages/icons-react/next/**',
// Templates
'packages/cli/src/component/templates/**',
// Generated files.
'**/generated/',
'config/typescript-config-carbon/index.js',
// TODO: Delete these ignores.
// https://github.com/carbon-design-system/carbon/issues/18991
// Tests.
'**/*-test.js',
'**/__tests__/**/*',
// TODO: Delete these ignores.
// https://github.com/carbon-design-system/carbon/issues/18991
// Stories.
'**/.storybook/**/*',
'**/*.stories.js',
'**/stories/**/*',
// TODO: Delete these ignores.
// https://github.com/carbon-design-system/carbon/issues/19012
'packages/react/src/components/Notification/a11yIconWarningSolid.js',
'packages/react/src/components/OverflowMenuV2/index.js',
'packages/react/src/components/Pagination/experimental/PageSelector.js',
'packages/react/src/components/Pagination/experimental/Pagination-story.js',
'packages/react/src/components/Pagination/experimental/Pagination.js',
'packages/react/src/components/Switch/IconSwitch.js',
// TODO: Delete these ignores.
// https://github.com/carbon-design-system/carbon/issues/19012
'www/src/components/Flex/index.js',
'www/src/components/Header/index.js',
'www/src/components/Text/index.js',
'www/src/components/WorkspaceList/index.js',
'www/src/pages/_app.js',
'www/src/pages/index.js',
'www/src/pages/insights/\\[owner\\]/\\[repo\\].js',
'www/src/pages/insights/index.js',
'www/src/pages/packages/\\[package\\]/index.js',
'www/src/pages/packages/index.js',
// TODO:
// 1. Delete this ignore.
// 2. Delete `--no-warn-ignored` from the `lint` script in `package.json`.
//
// https://github.com/carbon-design-system/carbon/issues/18991
'**/*.{ts,tsx}',
],
},
]);