forked from EliteMasterEric/Teyvat.moe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
71 lines (66 loc) · 2.65 KB
/
.eslintrc.js
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
module.exports = {
env: {
browser: true,
node: true,
},
settings: {
// Import should respect ~ as './src'
'import/resolver': {
'babel-plugin-root-import': {},
},
},
parser: '@babel/eslint-parser',
extends: ['airbnb', 'prettier', 'prettier/react'],
plugins: ['@babel', 'prettier', 'mui-unused-classes', 'json-files'],
rules: {
/**
* Set up basic formatting rules with the Prettier plugin.
* This helps maintain a consistent code style.
*/
'prettier/prettier': ['warn'],
/**
* Add a warning for unused variables, except if they start with '_'.
* This flags the variable as 'unused, but potentially used in future'.
*/
'no-unused-vars': [
'warn',
{
varsIgnorePattern: '_.*', // Prefix variables you know will be unused with an underscore.
argsIgnorePattern: '_.*', // Prefix arguments you know will be unused with an underscore.
},
],
/**
* Allow use of console commands at specific log levels.
* Instances of console.log and console.info should be stripped.
*/
'no-console': ['warn', { allow: ['warn', 'error', 'debug'] }],
/**
* Make less severe/important issues throw warnings instead of breaking the program.
* Don't add stuff here if it can be autofixed.
*/
'mui-unused-classes/unused-classes': ['warn'],
'react/self-closing-comp': ['warn'],
'object-shorthand': ['warn'],
'react/jsx-boolean-value': ['warn'],
/**
* Validate Node JSON files.
*/
'json-files/no-branch-in-dependencies': ['error'],
'json-files/require-engines': ['error'],
'json-files/require-license': ['error'],
'json-files/restrict-ranges': ['error'],
'json-files/sort-package-json': ['error'],
/**
* Turn off rules I don't like, or that annoy me.
*/
'react/jsx-filename-extension': ['off'], // Tried to turn this on but babel-plugin-root-import complains.
'react/prop-types': ['off'], // I don't use TypeScript.
'no-underscore-dangle': ['off'], // Allow dangling underscores in identifier names.
'no-case-declarations': ['off'], // Allow variables to be declared in case blocks.
'import/prefer-default-export': ['off'], // Allow single exports in files. They may get more later.
'import/no-dynamic-require': ['off'], // Dynamic requires are used to reference images.
'global-require': ['off'], // Local requires are used to reference images.
'react/jsx-props-no-spreading': ['off'], // I don't mind passing spread properties using {...other} in JSX.
'max-classes-per-file': ['off'], // I don't mind having multiple classes in one file, to keep them organized.
},
};