This repository has been archived by the owner on Oct 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 122
/
Copy path.eslintrc.cjs
105 lines (105 loc) · 3.2 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
module.exports = {
extends: [
'plugin:prettier/recommended',
'eslint-config-airbnb-base',
'plugin:eslint-comments/recommended',
'plugin:promise/recommended',
'plugin:unicorn/recommended',
'standard',
'prettier',
],
plugins: ['standard', 'eslint-comments', 'promise', 'unicorn'],
parser: '@babel/eslint-parser',
parserOptions: {
requireConfigFile: false,
babelOptions: {
babelrc: false,
configFile: false,
presets: ['@babel/preset-env'],
},
sourceType: 'module',
allowImportExportEverywhere: false,
codeFrame: true,
},
ignorePatterns: [
'cicd/*.yml', // Ignore YAML files as we uses partials with indentation for CICD
'**/node_modules/',
'**/dist/',
'**/.nyc_output',
'**/coverage',
'**/.serverless',
'**/.webpack',
'frontend/build/static/',
'cicd/**/*.js',
'**/*.json',
],
env: {
node: true,
browser: true,
},
rules: {
indent: 'off', // Disable indent since prettier will do this
'global-require': 'off', // disable no global require, managed through eslint-plugin-node
'no-prototype-builtins': 'off', // Too restrictive, writing ugly code to defend against a very unlikely scenario: https://eslint.org/docs/rules/no-prototype-builtins
'import/prefer-default-export': 'off', // https://basarat.gitbooks.io/typescript/docs/tips/defaultIsBad.html
'import/no-default-export': 'error',
'import/no-extraneous-dependencies': 'off',
'class-methods-use-this': 'off',
'node/no-unpublished-import': 'off',
'node/no-extraneous-import': 'off',
'unicorn/prevent-abbreviations': 'off',
'unicorn/prefer-top-level-await': 'off',
'unicorn/no-array-reduce': ["error", {"allowSimpleOperations": true}],
'no-restricted-syntax': [
'error',
{
selector: 'ForInStatement',
message:
'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.',
},
{
selector: 'LabeledStatement',
message:
'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
},
{
selector: 'WithStatement',
message:
'`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
},
],
'no-nested-ternary': 'off', // sometimes these are much clearer than if else blocks
complexity: ['warn', { max: 10 }],
// enforce kebab case filenames
'unicorn/filename-case': [
'error',
{
case: 'kebabCase',
},
],
'import/extensions': ['error', 'ignorePackages', {
js: 'always',
}],
},
overrides: [
{
files: ['**/*.test.*', 'test/**', 'util/**'],
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
complexity: 'off',
'global-require': 'off',
'no-await-in-loop': 'off',
'no-console': 'off',
'no-underscore-dangle': 'off',
'no-shadow': 'off',
},
},
{
files: ['**/scripts/**'],
rules: {
'no-console': 'off',
'no-undef': 'off',
},
},
],
};