Skip to content

Commit 5538b90

Browse files
committed
code linted!
1 parent fb829aa commit 5538b90

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+8243
-158
lines changed

.eslintrc.js

+157
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
const airbnb = require('eslint-config-airbnb-base/rules/variables');
2+
3+
const noRestrictedGlobals = airbnb.rules['no-restricted-globals'];
4+
const index = noRestrictedGlobals.findIndex(e => e.name === 'isNaN');
5+
noRestrictedGlobals.splice(index, 1);
6+
7+
module.exports = {
8+
parser: '@typescript-eslint/parser',
9+
parserOptions: { ecmaVersion: 2021, sourceType: 'module' },
10+
ignorePatterns: ['resources', 'src/plugins.d.ts'],
11+
plugins: ['unused-imports'],
12+
extends: [
13+
'airbnb-base/legacy',
14+
'plugin:@typescript-eslint/recommended',
15+
],
16+
rules: {
17+
'no-tabs': 'off',
18+
indent: ['error', 'tab', { SwitchCase: 1 }],
19+
quotes: ['error', 'single'],
20+
semi: ['error', 'always'],
21+
curly: ['error', 'multi-line'],
22+
'max-len': [
23+
'warn',
24+
{
25+
code: 140,
26+
ignoreStrings: true,
27+
ignoreTemplateLiterals: true,
28+
ignoreRegExpLiterals: true,
29+
},
30+
],
31+
'comma-dangle': [
32+
'warn',
33+
{
34+
arrays: 'always-multiline',
35+
objects: 'always-multiline',
36+
imports: 'always-multiline',
37+
exports: 'always-multiline',
38+
functions: 'never',
39+
},
40+
],
41+
'no-underscore-dangle': 'off',
42+
'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
43+
'padding-line-between-statements': [
44+
'error',
45+
{ blankLine: 'always', prev: 'export', next: '*' },
46+
{ blankLine: 'always', prev: 'import', next: '*' },
47+
{ blankLine: 'never', prev: 'import', next: 'import' },
48+
{ blankLine: 'any', prev: 'export', next: 'export' },
49+
],
50+
'array-element-newline': ['error', 'consistent'],
51+
'new-cap': ['error', {
52+
newIsCap: true,
53+
capIsNew: false,
54+
properties: false,
55+
newIsCapExceptions: ['ctor'],
56+
}],
57+
58+
'object-curly-newline': ['error', { ImportDeclaration: 'never' }],
59+
60+
'object-shorthand': ['error', 'always', { avoidQuotes: true, ignoreConstructors: true, avoidExplicitReturnArrows: true }],
61+
'newline-per-chained-call': ['error', { ignoreChainWithDepth: 3 }],
62+
63+
'one-var': 'off',
64+
'one-var-declaration-per-line': 'off',
65+
'no-multi-assign': 'off',
66+
67+
'no-unused-vars': 'off',
68+
'@typescript-eslint/no-unused-vars': 'off',
69+
'unused-imports/no-unused-imports': 'error',
70+
'unused-imports/no-unused-vars': [
71+
'warn',
72+
{
73+
vars: 'all',
74+
varsIgnorePattern: '^_',
75+
args: 'after-used',
76+
argsIgnorePattern: '^_',
77+
},
78+
],
79+
'@typescript-eslint/no-var-requires': 'off',
80+
81+
'no-bitwise': 'off',
82+
'no-plusplus': 'off',
83+
'no-continue': 'off',
84+
'class-methods-use-this': 'off',
85+
86+
'@typescript-eslint/explicit-module-boundary-types': 'off',
87+
'@typescript-eslint/no-empty-function': 'off',
88+
'@typescript-eslint/no-shadow': ['error'],
89+
'no-shadow': 'off',
90+
91+
'no-restricted-globals': noRestrictedGlobals,
92+
'no-param-reassign': 'off',
93+
'no-use-before-define': 'off',
94+
'@typescript-eslint/no-explicit-any': 'off',
95+
'default-case': 'off',
96+
'no-return-assign': 'off',
97+
'max-classes-per-file': 'off',
98+
99+
// this could be set true for release builds
100+
'no-console': 'off',
101+
102+
'no-restricted-imports': ['error', {
103+
paths: [
104+
// avoid importing index
105+
'.',
106+
'..',
107+
'../..',
108+
'../../..',
109+
'../../../..',
110+
'../../../../..',
111+
// avoid importing node.js core imports
112+
'assert',
113+
'buffer',
114+
'child_process',
115+
'cluster',
116+
'crypto',
117+
'dgram',
118+
'dns',
119+
'domain',
120+
'events',
121+
'freelist',
122+
'fs',
123+
'http',
124+
'https',
125+
'module',
126+
'net',
127+
'os',
128+
'path',
129+
'punycode',
130+
'querystring',
131+
'readline',
132+
'repl',
133+
'smalloc',
134+
'stream',
135+
'string_decoder',
136+
'sys',
137+
'timers',
138+
'tls',
139+
'tracing',
140+
'tty',
141+
'url',
142+
'util',
143+
'vm',
144+
'zlib',
145+
],
146+
patterns: ['index'],
147+
}],
148+
149+
// specific for framework
150+
'@typescript-eslint/no-this-alias': 'off',
151+
'@typescript-eslint/no-empty-interface': 'off',
152+
'no-namespace': 'off',
153+
'@typescript-eslint/no-namespace': 'off',
154+
'no-cond-assign': 'off',
155+
'no-nested-ternary': 'off',
156+
},
157+
};

0 commit comments

Comments
 (0)