Skip to content

Commit

Permalink
Merge pull request #292 from kitbagjs/eslint-9
Browse files Browse the repository at this point in the history
  • Loading branch information
stackoverfloweth authored Nov 7, 2024
2 parents 6138cd4 + 1a38302 commit 43c8a13
Show file tree
Hide file tree
Showing 140 changed files with 1,014 additions and 2,347 deletions.
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"eslint.rules.customizations": [
{
"rule": "@stylistic/*",
"fixable": true,
"severity": "warn"
}
],
"typescript.tsdk": "node_modules/typescript/lib",
"cSpell.words": [
"composables",
"tseslint",
"vitepress"
],
}
191 changes: 191 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
import globals from 'globals'
import tseslint from 'typescript-eslint'
import pluginVue from 'eslint-plugin-vue'
import stylistic from '@stylistic/eslint-plugin'

/** @type {import('eslint').Linter.Config[]} */
export default [
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
stylistic.configs['recommended-flat'],
{
files: [
'**/*.{ts,vue}',
],
languageOptions: {
globals: globals.browser,
parserOptions: {
parser: tseslint.parser,
projectService: true,
tsconfigRootDir: import.meta.dirname,
extraFileExtensions: ['.vue'],
},
},
rules: {
'no-duplicate-imports': ['warn'],
'no-extra-parens': ['warn'],
'@typescript-eslint/array-type': ['warn'],
'@typescript-eslint/consistent-type-definitions': ['off'],
'@typescript-eslint/explicit-function-return-type': ['warn', { allowExpressions: true }],
'@typescript-eslint/explicit-member-accessibility': ['warn'],
'@typescript-eslint/method-signature-style': ['warn', 'property'],
'@typescript-eslint/no-empty-function': ['off'],
'@typescript-eslint/no-empty-object-type': ['off'],
'@typescript-eslint/no-floating-promises': ['off'],
'@typescript-eslint/no-inferrable-types': ['off'],
'@typescript-eslint/no-unsafe-argument': ['off'],
'@typescript-eslint/no-unsafe-assignment': ['off'],
'@typescript-eslint/no-unsafe-call': ['off'],
'@typescript-eslint/no-unsafe-member-access': ['off'],
'@typescript-eslint/no-unsafe-return': ['off'],
'@typescript-eslint/no-unused-vars': ['warn', { ignoreRestSiblings: true }],
'@typescript-eslint/non-nullable-type-assertion-style': ['warn'],
'@typescript-eslint/parameter-properties': ['warn'],
'@typescript-eslint/prefer-enum-initializers': ['warn'],
'@typescript-eslint/prefer-nullish-coalescing': ['warn', { ignoreConditionalTests: true }],
'@typescript-eslint/prefer-readonly': ['warn'],
'@typescript-eslint/require-array-sort-compare': ['warn'],
'@typescript-eslint/require-await': ['off'],
'@typescript-eslint/restrict-template-expressions': ['off'],
'@typescript-eslint/switch-exhaustiveness-check': ['warn'],
'@typescript-eslint/unbound-method': ['off'],
'@typescript-eslint/unified-signatures': ['off'],
'@stylistic/arrow-parens': ['warn', 'always'],
'@stylistic/array-bracket-newline': ['warn', 'consistent'],
'@stylistic/array-element-newline': ['warn', { consistent: true, multiline: true }],
'@stylistic/brace-style': ['warn', '1tbs'],
'@stylistic/comma-dangle': ['warn', { arrays: 'always-multiline', objects: 'always-multiline', imports: 'never', exports: 'never', functions: 'always-multiline' }],
'@stylistic/comma-spacing': ['warn'],
'@stylistic/curly-newline': ['warn', { multiline: true, consistent: true }],
'@stylistic/dot-location': ['warn', 'property'],
'@stylistic/func-call-spacing': ['warn'],
'@stylistic/function-call-spacing': ['warn'],
'@stylistic/implicit-arrow-linebreak': ['warn'],
'@stylistic/key-spacing': ['warn', { afterColon: true }],
'@stylistic/keyword-spacing': ['warn', { before: true, after: true }],
'@stylistic/member-delimiter-style': ['warn', { multiline: { delimiter: 'comma', requireLast: true }, singleline: { delimiter: 'comma', requireLast: false } }],
'@stylistic/newline-per-chained-call': ['warn', { ignoreChainWithDepth: 2 }],
'@stylistic/no-confusing-arrow': ['warn'],
'@stylistic/object-curly-newline': ['warn', { multiline: true, consistent: true }],
'@stylistic/object-curly-spacing': ['warn', 'always'],
'@stylistic/operator-linebreak': ['warn', 'none', { overrides: { '||': 'before', '&&': 'before' } }],
'@stylistic/object-property-newline': ['warn', { allowAllPropertiesOnSameLine: true }],
'@stylistic/one-var-declaration-per-line': ['warn'],
'@stylistic/quotes': ['warn', 'single', { avoidEscape: true }],
'@stylistic/space-before-function-paren': ['warn', { anonymous: 'never', named: 'never', asyncArrow: 'always' }],
'@stylistic/spaced-comment': ['warn', 'always', { markers: ['/'] }],
'@stylistic/switch-colon-spacing': ['warn'],
},
},
...pluginVue.configs['flat/recommended'],
{
files: [
'**/*.vue',
],
rules: {
'@stylistic/indent': ['off'],
'vue/script-indent': [
'warn', 2, { baseIndent: 1 },
],
'vue/array-bracket-newline': ['warn', 'consistent'],
'vue/array-element-newline': ['warn', { consistent: true, multiline: true }],
'vue/brace-style': ['warn', '1tbs'],
'vue/comma-dangle': ['warn', { arrays: 'always-multiline', objects: 'always-multiline', imports: 'never', exports: 'never', functions: 'always-multiline' }],
'vue/comma-spacing': ['warn', { before: true, after: false }],
'vue/dot-location': ['warn', 'property'],
'vue/key-spacing': ['warn', { afterColon: true }],
'vue/keyword-spacing': ['warn', { before: true, after: true }],
'vue/object-curly-newline': ['warn', { multiline: true, consistent: true }],
'vue/object-curly-spacing': ['warn', 'always'],
'vue/operator-linebreak': ['warn', 'none'],
'vue/object-property-newline': ['warn', { allowAllPropertiesOnSameLine: true }],
'vue/block-tag-newline': ['warn'],
'vue/brace-style': ['warn', '1tbs'],
'vue/camelcase': ['warn'],
'vue/comma-dangle': ['warn', { arrays: 'always-multiline', objects: 'always-multiline', imports: 'never', exports: 'never', functions: 'never' }],
'vue/comma-spacing': ['warn'],
'vue/component-definition-name-casing': ['warn'],
'vue/component-name-in-template-casing': ['off'],
'vue/component-options-name-casing': ['warn'],
'vue/component-tags-order': ['warn', { order: ['template', 'script', 'style'] }],
'vue/custom-event-name-casing': ['warn'],
'vue/dot-location': ['warn', 'property'],
'vue/dot-notation': ['warn'],
'vue/first-attribute-linebreak': ['warn'],
'vue/func-call-spacing': ['warn'],
'vue/html-button-has-type': ['warn'],
'vue/html-closing-bracket-newline': ['warn'],
'vue/html-closing-bracket-spacing': ['warn'],
'vue/html-comment-content-newline': ['warn'],
'vue/html-comment-content-spacing': ['warn'],
'vue/html-comment-indent': ['warn'],
'vue/html-end-tags': ['warn'],
'vue/html-indent': ['warn'],
'vue/html-quotes': ['warn'],
'vue/html-self-closing': ['warn'],
'vue/key-spacing': ['warn', { afterColon: true }],
'vue/keyword-spacing': ['warn', { before: true, after: true }],
'vue/match-component-file-name': ['warn'],
'vue/max-attributes-per-line': ['warn', { singleline: { max: 5 }, multiline: { max: 1 } }],
'vue/multi-word-component-names': ['warn'],
'vue/multiline-html-element-content-newline': ['warn'],
'vue/mustache-interpolation-spacing': ['warn'],
'vue/new-line-between-multi-line-property': ['warn'],
'vue/next-tick-style': ['warn'],
'vue/no-boolean-default': ['warn'],
'vue/no-child-content': ['warn'],
'vue/no-duplicate-attr-inheritance': ['warn'],
'vue/no-empty-component-block': ['warn'],
'vue/no-expose-after-await': ['warn'],
'vue/no-extra-parens': ['warn'],
'vue/no-invalid-model-keys': ['warn'],
'vue/no-lone-template': ['warn'],
'vue/no-multi-spaces': ['warn'],
'vue/no-multiple-objects-in-class': ['warn'],
'vue/no-multiple-slot-args': ['warn'],
'vue/no-potential-component-option-typo': ['warn'],
'vue/no-reserved-component-names': ['warn'],
'vue/no-spaces-around-equal-signs-in-attribute': ['warn'],
'vue/no-static-inline-styles': ['warn'],
'vue/no-template-shadow': ['warn'],
'vue/no-this-in-before-route-enter': ['warn'],
'vue/no-undef-properties': ['warn'],
'vue/no-unused-properties': ['warn'],
'vue/no-unused-refs': ['warn'],
'vue/no-use-computed-property-like-method': ['warn'],
'vue/no-useless-concat': ['warn'],
'vue/no-useless-mustaches': ['warn'],
'vue/no-useless-v-bind': ['warn'],
'vue/no-v-html': ['warn'],
'vue/no-v-text': ['warn'],
'vue/object-curly-newline': ['warn', { multiline: true, consistent: true }],
'vue/object-curly-spacing': ['warn', 'always'],
'vue/object-property-newline': ['warn', { allowAllPropertiesOnSameLine: true }],
'vue/one-component-per-file': ['warn'],
'vue/order-in-components': ['warn'],
'vue/padding-line-between-blocks': ['warn'],
'vue/prefer-separate-static-class': ['warn'],
'vue/prefer-template': ['warn'],
'vue/prop-name-casing': ['warn'],
'vue/require-default-prop': ['warn'],
'vue/require-direct-export': ['warn'],
'vue/require-explicit-emits': ['warn'],
'vue/require-expose': ['warn'],
'vue/require-name-property': ['warn'],
'vue/require-prop-types': ['warn'],
'vue/script-indent': ['warn', 2, { baseIndent: 1, switchCase: 1 }],
'vue/singleline-html-element-content-newline': ['warn'],
'vue/space-in-parens': ['warn'],
'vue/this-in-template': ['warn'],
'vue/v-bind-style': ['warn'],
'vue/v-on-event-hyphenation': ['warn'],
'vue/v-on-function-call': ['warn'],
'vue/v-on-style': ['warn'],
'vue/v-slot-style': ['warn'],
},
},
{
files: ['**/*.js'],
...tseslint.configs.disableTypeChecked,
},
]
Loading

0 comments on commit 43c8a13

Please sign in to comment.