/ eslint.config.ts
eslint.config.ts
1 import { defineConfig, globalIgnores } from 'eslint/config' 2 import js from '@eslint/js' 3 import css from '@eslint/css' 4 import globals from 'globals' 5 import tslint from 'typescript-eslint' 6 import stylisticPlugin from '@stylistic/eslint-plugin' 7 import importPlugin from 'eslint-plugin-import' 8 import reactPlugin from 'eslint-plugin-react' 9 import reactHooksPlugin from 'eslint-plugin-react-hooks' 10 import reactCompilerPlugin from 'eslint-plugin-react-compiler' 11 import { tailwind4 } from 'tailwind-csstree' 12 13 14 export default defineConfig( 15 globalIgnores([ '.history/**', 'dist/**', 'dev-dist/**', 'deno-deploy-serve.ts' ]), 16 { linterOptions: { reportUnusedDisableDirectives: 'error' } }, 17 { 18 files: [ '**/*.{js,jsx,ts,tsx}' ], 19 ignores: [ '.history/', 'dist/', 'dev-dist/' ], 20 languageOptions: { 21 parser: tslint.parser, 22 parserOptions: { 23 projectService: true, 24 }, 25 globals: { 26 ...globals.browser, 27 JSX: 'readonly', 28 } 29 }, 30 extends: [ 31 js.configs.recommended, 32 tslint.configs.recommended, 33 tslint.configs.recommendedTypeChecked, 34 stylisticPlugin.configs.recommended, 35 // importPlugin.configs.recommended, 36 // reactPlugin.configs.flat, 37 // reactHooksPlugin.configs.recommended, 38 // reactCompilerPlugin.configs.recommended, 39 ], 40 plugins: { 41 '@typescript-eslint': tslint.plugin, 42 '@stylistic': stylisticPlugin, 43 'import': importPlugin, 44 // @ts-expect-error Types of parameters 'context' and 'context' are incompatible 45 'react': reactPlugin, 46 // @ts-expect-error no properties in common with type 'Plugin' 47 'react-hooks': reactHooksPlugin, 48 'react-compiler': reactCompilerPlugin, 49 }, 50 settings: { 51 react: { version: 'detect' }, 52 }, 53 rules: { 54 'semi': [ 'error', 'never' ], 55 'no-mixed-spaces-and-tabs': [ 'error', 'smart-tabs' ], 56 'eqeqeq': 'off', 57 'default-case': 'off', 58 'no-cond-assign': 'off', 59 'no-mixed-operators': 'off', 60 'import/no-anonymous-default-export': 'off', 61 '@stylistic/array-bracket-spacing': [ 'error', 'always', { objectsInArrays: false, arraysInArrays: false }], 62 '@stylistic/arrow-parens': [ 'error', 'as-needed' ], 63 '@stylistic/brace-style': [ 'error', '1tbs', { allowSingleLine: true }], 64 '@stylistic/comma-dangle': 'off', 65 '@stylistic/indent': [ 'warn', 'tab' ], 66 '@stylistic/indent-binary-ops': 'off', 67 '@stylistic/jsx-closing-tag-location': [ 'error', 'line-aligned' ], 68 '@stylistic/jsx-indent-props': [ 'error', 'tab' ], 69 '@stylistic/jsx-one-expression-per-line': 'off', 70 '@stylistic/jsx-quotes': [ 'warn', 'prefer-double' ], 71 '@stylistic/jsx-tag-spacing': [ 'error', { 72 closingSlash: 'never', 73 beforeSelfClosing: 'never', 74 afterOpening: 'never', 75 beforeClosing: 'never' 76 }], 77 '@stylistic/jsx-wrap-multilines': [ 'error', { 78 return: 'parens', 79 arrow: 'ignore', 80 }], 81 '@stylistic/max-statements-per-line': 'off', 82 '@stylistic/member-delimiter-style': [ 'error', { 83 multiline: { 84 delimiter: 'comma', 85 requireLast: true, 86 }, 87 singleline: { 88 delimiter: 'comma', 89 requireLast: false, 90 }, 91 multilineDetection: 'brackets', 92 }], 93 '@stylistic/multiline-ternary': 'off', 94 '@stylistic/no-mixed-operators': 'off', 95 '@stylistic/no-mixed-spaces-and-tabs': [ 'warn', 'smart-tabs' ], 96 '@stylistic/no-multiple-empty-lines': [ 'error', { max: 2 }], 97 '@stylistic/no-tabs': 'off', 98 '@stylistic/operator-linebreak': 'off', 99 '@stylistic/quotes': [ 'warn', 'single' ], 100 '@typescript-eslint/no-unsafe-argument': 'error', 101 '@typescript-eslint/no-unsafe-assignment': 'error', 102 '@typescript-eslint/no-unsafe-call': 'error', 103 '@typescript-eslint/no-unsafe-member-access': 'error', 104 '@typescript-eslint/no-unsafe-return': 'error', 105 } 106 }, { 107 files: [ '**/*.css' ], 108 ignores: [ '.history/**', 'dist/**', 'dev-dist/**' ], 109 language: 'css/css', 110 languageOptions: { customSyntax: tailwind4 }, 111 plugins: { css }, 112 extends: [ 113 css.configs.recommended 114 ], 115 } 116 )