-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy patheslint.config.js
More file actions
88 lines (87 loc) · 2.19 KB
/
eslint.config.js
File metadata and controls
88 lines (87 loc) · 2.19 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
const { defineConfig, globalIgnores } = require('eslint/config')
const js = require('@eslint/js')
const globals = require('globals')
const react = require('eslint-plugin-react')
const prettier = require('eslint-plugin-prettier')
const prettierConfig = require('eslint-config-prettier/flat')
const cypressPlugin = require('eslint-plugin-cypress')
module.exports = defineConfig([
globalIgnores([
'**/playground',
'**/.cache',
'**/build',
'**/node_modules/**',
'**/dist',
]),
{
files: ['**/*.js'],
languageOptions: {
ecmaVersion: 11,
sourceType: 'module',
globals: {
...globals.browser,
...globals.commonjs,
...globals.node,
...globals.jest,
strapi: 'readonly',
},
parserOptions: {
ecmaFeatures: { jsx: true },
},
},
plugins: {
react,
prettier,
},
settings: {
// Explicit version avoids eslint-plugin-react's getFilename() path (incompatible with ESLint 10)
react: { version: '18.0' },
},
rules: {
...js.configs.recommended.rules,
...react.configs.recommended.rules,
...prettierConfig.rules,
'cypress/no-unnecessary-waiting': 'off',
'react/prop-types': 'off',
'react/jsx-closing-bracket-location': [2, 'tag-aligned'],
'array-callback-return': 'off',
'arrow-parens': ['error', 'as-needed'],
'no-unused-vars': [
'error',
{
args: 'all',
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'prettier/prettier': [
'error',
{
quoteProps: 'consistent',
semi: false,
arrowParens: 'avoid',
singleQuote: true,
},
],
},
},
{
files: ['cypress/**/*.js', 'cypress.config.js'],
plugins: { cypress: cypressPlugin },
languageOptions: {
globals: {
...globals.browser,
...globals.mocha,
cy: 'readonly',
Cypress: 'readonly',
expect: 'readonly',
assert: 'readonly',
chai: 'readonly',
},
},
rules: {
...cypressPlugin.configs.recommended.rules,
'cypress/no-unnecessary-waiting': 'off',
},
},
])