forked from freesewing/freesewing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.cjs
133 lines (128 loc) · 3.21 KB
/
.eslintrc.cjs
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
const jsSuffixes = '{js,mjs,cjs,jsx}'
const mongoFiles = [`ansible/playbooks/files/migrate_data.${jsSuffixes}`]
const nodeFiles = [
`**/build.dflt.${jsSuffixes}`,
`**/build.${jsSuffixes}`,
`**/config/**/*.${jsSuffixes}`,
`**/*.config.${jsSuffixes}`,
`**/prebuild.${jsSuffixes}`,
`**/prebuild/**/*.${jsSuffixes}`,
`**/scripts/**/*.${jsSuffixes}`,
`packages/new-design/lib/**/*.${jsSuffixes}`,
`sites/backend/**/*.${jsSuffixes}`,
`sites/*/mdx/**/*.${jsSuffixes}`,
`sites/*/themes/**/*.${jsSuffixes}`,
]
const frontendFiles = [
`**/components/**/*.${jsSuffixes}`,
`**/hooks/**/*.${jsSuffixes}`,
`**/pages/**/*.${jsSuffixes}`,
`**/page-templates/**/*.${jsSuffixes}`,
`packages/i18n/**/*.md/*.${jsSuffixes}`,
`packages/react-components/**/*.${jsSuffixes}`,
]
module.exports = {
extends: 'eslint:recommended',
env: {
es2021: true,
node: true,
},
// Required when using experimental EcmaScript features
parser: '@babel/eslint-parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
// Options specific to the Babel parser
requireConfigFile: false,
babelOptions: {
plugins: ['@babel/plugin-syntax-import-assertions'],
presets: ['@babel/preset-react'],
},
},
rules: {},
overrides: [
// Partitioned JavaScript files
{
files: mongoFiles,
plugins: ['mongo'],
env: {
'mongo/shell': true,
},
},
{
files: nodeFiles,
env: {
node: true,
},
rules: {
'no-console': 'off',
},
},
{
files: frontendFiles,
excludedFiles: nodeFiles,
extends: ['next'],
settings: {
next: {
rootDir: 'sites/dev/',
},
},
},
{
files: [`**/*.${jsSuffixes}{,.mustache}`],
excludedFiles: [].concat(mongoFiles, nodeFiles, frontendFiles),
env: {
'shared-node-browser': true,
},
},
// Additional globals for JavaScript files that happen to be CommonJS.
// Only allowed in *.cjs files, not *.js files, because we probably want to move towards
// a `"type": "module"` future where any CommonJS files would have to have .cjs extensions.
{
files: ['**/*.cjs'],
env: {
commonjs: true,
},
},
// Additional globals for JavaScript files that happen to contain Mocha tests
{
files: [
`**/tests/**/*.${jsSuffixes}`,
`**/*.test.${jsSuffixes}`,
'scripts/test-failure-collector.js',
],
env: {
mocha: true,
node: true,
},
},
// JSON files
{
files: ['**/*.{json,json5,jsonc}{,.mustache}'],
extends: ['plugin:jsonc/recommended-with-jsonc'],
parser: 'jsonc-eslint-parser',
},
// YAML files
{
files: ['**/*.yaml', '**/*.yml'],
plugins: ['yaml'],
extends: ['plugin:yaml/recommended'],
},
// Markdown files
{
files: ['**/markdown/**', '**/*.md'],
plugins: ['markdown'],
processor: 'markdown/markdown',
},
{
files: ['**/*.md/*.js'],
rules: {
'no-console': 'off',
'no-empty': 'off',
'no-undef': 'off',
'no-unused-labels': 'off',
'no-unused-vars': 'off',
},
},
],
}