From bd7dd29d57b3ddf561f747bbd0be11aa2029e781 Mon Sep 17 00:00:00 2001 From: Krutoy242 Date: Sat, 16 Dec 2023 13:24:38 +0300 Subject: [PATCH] =?UTF-8?q?build:=20=F0=9F=9A=A7add=20eslint=20config=20fi?= =?UTF-8?q?les?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will help other developers to get all the necessary tools for formatting with VSC. --- .gitignore | 5 ++++ eslint.config.js | 69 ++++++++++++++++++++++++++++++++++++++++++++++++ tsconfig.json | 11 ++++++++ 3 files changed, 85 insertions(+) create mode 100644 eslint.config.js create mode 100644 tsconfig.json diff --git a/.gitignore b/.gitignore index 75306776c..b584d2a65 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,11 @@ structures/inactive !.github/ !.imgbotconfig +# Developing-only configs +!.eslint.config.js +!.tsconfig.json +!.vscode/settings.json + # OTG configs !mods mods/* diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 000000000..d0a8d820a --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,69 @@ +import antfu from '@antfu/eslint-config' + +export default antfu({ + // typescript: { tsconfigPath: 'tsconfig.json' }, + gitignore: false, + rules : { + + // Override @antfu rules to my personal prefferences + 'style/key-spacing' : ['error', { align: 'colon' }], + 'antfu/if-newline' : 'off', + 'style/comma-dangle': [ + 'error', + { + functions: 'never', + imports : 'always-multiline', + exports : 'always-multiline', + arrays : 'always-multiline', + objects : 'always-multiline', + }, + ], + + // Lower error levels + 'style/max-statements-per-line': 'warn', + + // Sort imports + 'import/order': 'off', + 'sort-imports': 'off', + + 'unused-imports/no-unused-imports': 'error', + 'unused-imports/no-unused-vars' : 'error', + + 'perfectionist/sort-array-includes' : 'error', + 'perfectionist/sort-astro-attributes': 'error', + // 'perfectionist/sort-classes' : 'error', + 'perfectionist/sort-enums' : 'error', + 'perfectionist/sort-exports' : 'error', + 'perfectionist/sort-imports' : ['error', { + type : 'natural', + groups: [ + 'side-effect', + 'side-effect-style', + 'type', + 'builtin', + 'external', + 'internal-type', + 'internal', + ['parent-type', 'sibling-type', 'index-type'], + ['parent', 'sibling', 'index'], + 'object', + 'unknown', + ], + }], + 'perfectionist/sort-interfaces' : 'error', + 'perfectionist/sort-jsx-props' : 'error', + 'perfectionist/sort-maps' : 'error', + 'perfectionist/sort-named-exports' : 'error', + 'perfectionist/sort-named-imports' : 'error', + 'perfectionist/sort-object-types' : 'error', + // 'perfectionist/sort-objects': 'error', + 'perfectionist/sort-svelte-attributes': 'error', + 'perfectionist/sort-union-types' : 'error', + 'perfectionist/sort-vue-attributes' : 'error', + }, +}, { + files: ['**/*.md'], + rules: { + 'style/no-trailing-spaces': 'off', + }, +}) diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 000000000..e279f0add --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "target": "ESNext", + "experimentalDecorators": true, + "module": "ESNext", + "moduleResolution": "node", + "esModuleInterop": true + }, + "include": ["**/*.js", "**/*.ts"], + "exclude": ["node_modules", "**/*.spec.ts", "**/*.test.ts"] +}