Skip to content

Commit d6737ba

Browse files
committed
chore: update eslint rules
1 parent c4a452a commit d6737ba

File tree

3 files changed

+107
-10
lines changed

3 files changed

+107
-10
lines changed

eslint.config.js

Lines changed: 71 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ const ts = require('@typescript-eslint/eslint-plugin');
55
const eslintConfigPrettier = require('eslint-config-prettier');
66
const prettier = require('eslint-plugin-prettier');
77
const stylisticJs = require('@stylistic/eslint-plugin-js');
8+
const stylisticTs = require('@stylistic/eslint-plugin-ts');
9+
const stylisticPlus = require('@stylistic/eslint-plugin-plus')
810

911
module.exports = [
1012
{
@@ -16,7 +18,9 @@ module.exports = [
1618
plugins: {
1719
'@typescript-eslint': ts,
1820
'prettier': prettier,
19-
'@stylistic/js': stylisticJs
21+
'@stylistic/js': stylisticJs,
22+
'@stylistic/ts': stylisticTs,
23+
'@stylistic/plus': stylisticPlus
2024
},
2125
languageOptions: {
2226
parser: tsParser,
@@ -35,8 +39,8 @@ module.exports = [
3539
'space-before-function-paren': 0,
3640
'prefer-const': 1,
3741
'comma-dangle': 0,
38-
'keyword-spacing': ['error', { 'before': true, 'after': true }],
39-
'comma-spacing': ['error', { 'before': false, 'after': true }],
42+
'keyword-spacing': ['error', { before: true, after: true }],
43+
'comma-spacing': ['error', { before: false, after: true }],
4044
'indent': 0,
4145
'prefer-spread': 1,
4246
'eqeqeq': ['error', 'smart'],
@@ -57,13 +61,55 @@ module.exports = [
5761
'ignoreRestSiblings': true
5862
}
5963
],
60-
'@stylistic/js/no-multi-spaces': [0, { ignoreEOLComments: true }],
61-
'@stylistic/js/arrow-spacing': ['error', { 'before': true, 'after': true }],
62-
'@stylistic/js/arrow-parens': ['error', 'always'],
63-
'@stylistic/js/block-spacing': ['error', 'always'],
64-
'@stylistic/js/brace-style': ['error', 'allman', { 'allowSingleLine': true }],
65-
'@stylistic/js/comma-dangle': ['error', 'never'],
66-
'@stylistic/js/comma-spacing': ['error', { 'before': false, 'after': true }],
64+
65+
'@stylistic/js/no-multi-spaces': [ 0, { ignoreEOLComments: true } ],
66+
'@stylistic/js/arrow-spacing': [ 'error', { before: true, after: true } ],
67+
'@stylistic/js/arrow-parens': [ 'error', 'always' ],
68+
69+
'@stylistic/js/block-spacing': [ 'error', 'always' ],
70+
'@stylistic/ts/block-spacing': [ 'error', 'always' ],
71+
72+
'@stylistic/js/brace-style': [ 'error', 'allman', { allowSingleLine: true } ],
73+
'@stylistic/ts/brace-style': [ 'error', 'allman', { allowSingleLine: true } ],
74+
75+
'@stylistic/js/comma-dangle': [ 'error', 'never' ],
76+
'@stylistic/ts/comma-dangle': [ 'error', 'never' ],
77+
78+
'@stylistic/js/comma-spacing': [ 'error', { before: false, after: true }],
79+
'@stylistic/ts/comma-spacing': [ 'error', { before: false, after: true }],
80+
81+
'@stylistic/js/keyword-spacing': [ 'error', {
82+
before: true,
83+
after: true,
84+
'overrides':
85+
{
86+
return: { before: true, after: true },
87+
throw: { before: true, after: true },
88+
case: { before: true, after: true },
89+
as: { before: true, after: true },
90+
if: { before: true, after: true },
91+
for: { before: true, after: true },
92+
while: { before: true, after: true },
93+
static: { before: true, after: true }
94+
},
95+
}],
96+
97+
'@stylistic/ts/keyword-spacing': ['error', {
98+
before: true,
99+
after: true,
100+
'overrides':
101+
{
102+
return: { before: true, after: true },
103+
throw: { before: true, after: true },
104+
case: { before: true, after: true },
105+
as: { before: true, after: true },
106+
if: { before: true, after: true },
107+
for: { before: true, after: true },
108+
while: { before: true, after: true },
109+
static: { before: true, after: true }
110+
},
111+
}],
112+
67113
'@stylistic/js/computed-property-spacing': ['error', 'always'],
68114
'@stylistic/js/eol-last': ['error', 'always'],
69115
'@stylistic/js/jsx-quotes': ['error', 'prefer-single'],
@@ -72,17 +118,32 @@ module.exports = [
72118
'@stylistic/js/no-tabs': ['error'],
73119
'@stylistic/js/no-trailing-spaces': ['error', { 'skipBlankLines': true, 'ignoreComments': true }],
74120
'@stylistic/js/no-whitespace-before-property': ['error'],
121+
75122
'@stylistic/js/object-curly-spacing': ['error', 'always'],
123+
'@stylistic/ts/object-curly-spacing': ['error', 'always'],
124+
76125
'@stylistic/js/quote-props': ['error', 'as-needed'],
126+
'@stylistic/ts/quote-props': ['error', 'as-needed'],
127+
77128
'@stylistic/js/quotes': ['error', 'single', { 'allowTemplateLiterals': true }],
129+
'@stylistic/ts/quotes': ['error', 'single', { 'allowTemplateLiterals': true }],
130+
78131
'@stylistic/js/semi': ['error', 'never'],
132+
'@stylistic/ts/semi': ['error', 'never'],
133+
79134
'@stylistic/js/space-in-parens': ['error', 'always'],
135+
80136
'@stylistic/js/space-infix-ops': ['error'],
137+
'@stylistic/ts/space-infix-ops': ['error'],
138+
81139
'@stylistic/js/spaced-comment': ['error', 'always'],
82140
'@stylistic/js/template-curly-spacing': ['error', 'always'],
83141
'@stylistic/js/template-tag-spacing': ['error', 'always'],
84142
'@stylistic/js/wrap-iife': [2, "inside", { functionPrototypeMethods: true }],
85143

144+
'@stylistic/plus/type-named-tuple-spacing': ["error"],
145+
'@stylistic/plus/type-generic-spacing': ["error"],
146+
86147
// 'prettier/prettier': ['error'],
87148

88149
// @typescript-eslint rules

package-lock.json

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@
8282
"eslint-config-prettier": "^9.1.0",
8383
"eslint-plugin-prettier": "^5.1.3",
8484
"@stylistic/eslint-plugin-js": "^2.3.0",
85+
"@stylistic/eslint-plugin-ts": "^2.3.0",
86+
"@stylistic/eslint-plugin-plus": "^2.3.0",
8587
"electron": "^31.1.0",
8688
"obsidian": "^1.0.0",
8789
"rollup": "^4.18.0",

0 commit comments

Comments
 (0)