Skip to content

Commit 5dfccd8

Browse files
committed
πŸ‘¨β€πŸ”¬ ESLint config update
1 parent c0da19b commit 5dfccd8

File tree

6 files changed

+505
-187
lines changed

6 files changed

+505
-187
lines changed

β€Ž.eslintrcβ€Ž

Lines changed: 0 additions & 123 deletions
This file was deleted.

β€Ždist/index.d.tsβ€Ž

Lines changed: 0 additions & 63 deletions
This file was deleted.

β€Ždist/index.d.ts.mapβ€Ž

Lines changed: 0 additions & 1 deletion
This file was deleted.

β€Žeslintrc.config.mjsβ€Ž

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
import typescriptEslintParser from '@typescript-eslint/parser';
2+
import typescriptEslintPlugin from '@typescript-eslint/eslint-plugin';
3+
import stylistic from '@stylistic/eslint-plugin';
4+
import jsGlobals from 'globals';
5+
6+
const globals = {
7+
// Browser globals:
8+
...jsGlobals.browser,
9+
...jsGlobals.serviceworker,
10+
...jsGlobals.worker,
11+
};
12+
13+
export default [
14+
{
15+
files: ['**/*.ts'],
16+
languageOptions: {
17+
parser: typescriptEslintParser,
18+
parserOptions: {
19+
ecmaVersion: 'latest',
20+
sourceType: 'module',
21+
project: './tsconfig.json',
22+
},
23+
globals,
24+
},
25+
plugins: {
26+
'@typescript-eslint': typescriptEslintPlugin,
27+
'@stylistic': stylistic,
28+
},
29+
rules: {
30+
'@typescript-eslint/consistent-type-imports': 'warn',
31+
'@typescript-eslint/no-non-null-assertion': 'warn',
32+
'@typescript-eslint/no-explicit-any': 'warn',
33+
'@typescript-eslint/no-shadow': 2,
34+
'@typescript-eslint/no-unused-vars': [
35+
'error',
36+
{
37+
args: 'all',
38+
argsIgnorePattern: '^_',
39+
caughtErrors: 'all',
40+
caughtErrorsIgnorePattern: '^_',
41+
destructuredArrayIgnorePattern: '^_',
42+
varsIgnorePattern: '^_',
43+
},
44+
],
45+
'@typescript-eslint/member-delimiter-style': [
46+
'error',
47+
{
48+
multiline: { delimiter: 'semi', requireLast: true },
49+
singleline: { delimiter: 'semi', requireLast: false },
50+
multilineDetection: 'brackets',
51+
},
52+
],
53+
'@typescript-eslint/type-annotation-spacing': 'error',
54+
'@typescript-eslint/no-use-before-define': [2, 'nofunc'],
55+
strict: [2, 'never'],
56+
'no-shadow-restricted-names': 2,
57+
'no-cond-assign': [2, 'always'],
58+
'no-console': 1,
59+
'no-debugger': 1,
60+
'no-alert': 1,
61+
'no-constant-condition': 1,
62+
'no-dupe-keys': 2,
63+
'no-duplicate-case': 2,
64+
'no-empty': 2,
65+
'no-ex-assign': 2,
66+
'no-extra-boolean-cast': 0,
67+
'no-func-assign': 2,
68+
'no-inner-declarations': 2,
69+
'no-invalid-regexp': 2,
70+
'no-irregular-whitespace': 2,
71+
'no-obj-calls': 2,
72+
'no-sparse-arrays': 2,
73+
'no-unreachable': 2,
74+
'use-isnan': 2,
75+
'block-scoped-var': 0,
76+
'consistent-return': 2,
77+
curly: [2, 'multi-line'],
78+
'default-case': 2,
79+
'dot-notation': [2, { allowKeywords: true }],
80+
eqeqeq: 2,
81+
'guard-for-in': 2,
82+
'no-caller': 2,
83+
'no-else-return': 2,
84+
'no-eq-null': 2,
85+
'no-eval': 2,
86+
'no-extend-native': 2,
87+
'no-extra-bind': 2,
88+
'no-fallthrough': 2,
89+
'no-implied-eval': 2,
90+
'no-lone-blocks': 2,
91+
'no-loop-func': 2,
92+
'no-multi-str': 2,
93+
'no-global-assign': 2,
94+
'no-new': 2,
95+
'no-new-func': 2,
96+
'no-new-wrappers': 2,
97+
'no-octal': 2,
98+
'no-octal-escape': 2,
99+
'no-param-reassign': 2,
100+
'no-proto': 2,
101+
'no-redeclare': 2,
102+
'no-return-assign': 2,
103+
'no-script-url': 2,
104+
'no-self-compare': 2,
105+
'no-sequences': 2,
106+
'no-throw-literal': 2,
107+
'no-with': 2,
108+
'no-object-constructor': 2,
109+
yoda: 2,
110+
'@stylistic/no-extra-semi': 2,
111+
'@stylistic/no-floating-decimal': 2,
112+
'@stylistic/wrap-iife': [2, 'any'],
113+
'@stylistic/indent': [2, 2],
114+
'@stylistic/brace-style': [2, '1tbs', { allowSingleLine: true }],
115+
'@stylistic/quotes': [2, 'single', 'avoid-escape'],
116+
'@stylistic/comma-spacing': [2, { before: false, after: true }],
117+
'@stylistic/comma-style': [2, 'last'],
118+
'@stylistic/eol-last': 2,
119+
'@stylistic/key-spacing': [2, { beforeColon: false, afterColon: true }],
120+
'@stylistic/no-multiple-empty-lines': [2, { max: 2 }],
121+
'@stylistic/no-trailing-spaces': 2,
122+
'@stylistic/padded-blocks': [2, 'never'],
123+
'@stylistic/semi': ['error', 'always'],
124+
'@stylistic/semi-spacing': [2, { before: false, after: true }],
125+
'@stylistic/space-infix-ops': 2,
126+
camelcase: [2, { properties: 'never' }],
127+
'no-nested-ternary': 2,
128+
'no-underscore-dangle': 0,
129+
'one-var': [2, 'never'],
130+
'@stylistic/arrow-parens': ['error', 'always'],
131+
'@stylistic/arrow-spacing': 'error',
132+
'@stylistic/block-spacing': ['error', 'always'],
133+
'@stylistic/keyword-spacing': [
134+
'error',
135+
{ before: true, after: true },
136+
],
137+
'@stylistic/space-before-blocks': ['error', 'always'],
138+
'@stylistic/space-before-function-paren': [
139+
'error',
140+
{
141+
anonymous: 'never',
142+
named: 'never',
143+
asyncArrow: 'always',
144+
},
145+
],
146+
'@stylistic/space-in-parens': ['error', 'never'],
147+
'@stylistic/space-unary-ops': [
148+
'error',
149+
{ words: true, nonwords: false },
150+
],
151+
'@stylistic/object-curly-spacing': ['error', 'always'],
152+
'@stylistic/object-curly-newline': [
153+
'error',
154+
{
155+
multiline: true,
156+
consistent: true,
157+
},
158+
],
159+
'@stylistic/object-property-newline': [
160+
'error',
161+
{ allowAllPropertiesOnSameLine: false },
162+
],
163+
'@stylistic/array-bracket-spacing': ['error', 'never'],
164+
'@stylistic/array-bracket-newline': [
165+
'error',
166+
{ multiline: true, minItems: 3 },
167+
],
168+
'@stylistic/newline-per-chained-call': [
169+
'error',
170+
{ ignoreChainWithDepth: 2 },
171+
],
172+
'@stylistic/operator-linebreak': [
173+
'error',
174+
'before',
175+
{ overrides: { '=': 'after' } },
176+
],
177+
'@stylistic/template-curly-spacing': ['error', 'never'],
178+
'@stylistic/func-call-spacing': ['error', 'never'],
179+
},
180+
},
181+
];

0 commit comments

Comments
Β (0)