From 0f13f27357f52d30fe94e82424be339d0710f87f Mon Sep 17 00:00:00 2001 From: 0t4u <61939142+0t4u@users.noreply.github.com> Date: Sat, 10 Aug 2024 16:14:33 +0800 Subject: [PATCH] chore: eslint rules --- eslint.config.mjs | 30 ++++++++++++++++++++++-------- package.json | 1 + 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 9bcc95f2..33525c14 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,6 +1,7 @@ // @ts-check import eslint from '@eslint/js'; import tseslint from 'typescript-eslint'; +import stylistic from '@stylistic/eslint-plugin'; import * as augu from '@augu/eslint-config'; export default tseslint.config( @@ -23,15 +24,28 @@ export default tseslint.config( tsconfigRootDir: import.meta.dirname, }, }, + plugins: { + '@stylistic': stylistic, + }, rules: { - 'indent': [ 'error', 4, { 'SwitchCase': 1 } ], - 'quotes': [ 'error', 'single' ], - 'brace-style': [ 'error', '1tbs' ], - 'object-curly-spacing': [ 'error', 'always' ], - 'array-bracket-spacing': [ 'error', 'always' ], - 'block-spacing': [ 'error', 'always' ], - 'arrow-spacing': 'error', - 'switch-colon-spacing': [ 'error', { 'after': true, 'before': false } ], + '@stylistic/semi': [ 'error' ], + '@stylistic/member-delimiter-style': [ 'error' ], + '@stylistic/indent': [ 'error', 4, { 'SwitchCase': 1 }], + '@stylistic/space-infix-ops': [ 'error' ], + '@stylistic/key-spacing': [ 'error', { 'mode': 'strict' }], + '@stylistic/keyword-spacing': [ 'error' ], + '@stylistic/indent-binary-ops': [ 'error', 4 ], + '@stylistic/type-generic-spacing': [ 'error' ], + '@stylistic/type-named-tuple-spacing': [ 'error' ], + '@stylistic/type-annotation-spacing': [ 'error', { 'before': false, 'after': true, 'overrides': { 'arrow': { 'before': true, 'after': true }}}], + '@stylistic/quotes': [ 'error', 'single' ], + '@stylistic/comma-dangle': [ 'error', 'always-multiline' ], + '@stylistic/brace-style': [ 'error', '1tbs' ], + '@stylistic/object-curly-spacing': [ 'error', 'always', { 'objectsInObjects': false, 'arraysInObjects': false }], + '@stylistic/array-bracket-spacing': [ 'error', 'always', { 'objectsInArrays': false, 'arraysInArrays': false }], + '@stylistic/block-spacing': [ 'error', 'always' ], + '@stylistic/arrow-spacing': 'error', + '@stylistic/switch-colon-spacing': [ 'error', { 'after': true, 'before': false }], 'camelcase': 'off', 'require-await': 'error', }, diff --git a/package.json b/package.json index 4a4ff18e..a7847654 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "devDependencies": { "@augu/eslint-config": "5.2.4", "@eslint/js": "^9.9.0", + "@stylistic/eslint-plugin": "^2.6.2", "@types/eslint__js": "^8.42.3", "@types/node": "^22.2.0", "@types/node-fetch": "^2.6.11",