Skip to content

Commit

Permalink
eslint v9
Browse files Browse the repository at this point in the history
  • Loading branch information
Shyam-Chen committed Jun 29, 2024
1 parent 69e615c commit 28c1d12
Show file tree
Hide file tree
Showing 6 changed files with 410 additions and 174 deletions.
44 changes: 0 additions & 44 deletions .eslintrc

This file was deleted.

4 changes: 0 additions & 4 deletions .prettierrc

This file was deleted.

80 changes: 80 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import globals from 'globals';
import pluginJs from '@eslint/js';
import tseslint from 'typescript-eslint';
import pluginVue from 'eslint-plugin-vue';
import pluginPrettierRecommendedConfigs from 'eslint-plugin-prettier/recommended';
import parserVue from 'vue-eslint-parser';

export default [
// js
pluginJs.configs.recommended,
// ts
...tseslint.configs.recommended,
{
rules: {
// The core 'no-unused-vars' rules (in the eslint:recommeded ruleset)
// does not work with type definitions
'no-unused-vars': 'off',
// TS already checks for that, and Typescript-Eslint recommends to disable it
// https://typescript-eslint.io/linting/troubleshooting#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
'no-undef': 'off',
'@typescript-eslint/no-unused-vars': 'warn',

'@typescript-eslint/no-explicit-any': 'warn',
},
},
// vue
...pluginVue.configs['flat/recommended'],
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
parser: parserVue,
parserOptions: {
parser: tseslint.parser,
sourceType: 'module',
extraFileExtensions: ['.vue'],
},
},
rules: {
'vue/multi-word-component-names': 'off',
'vue/attribute-hyphenation': ['error', 'never'],
'vue/v-on-event-hyphenation': ['error', 'never'],
'vue/no-v-html': 'off',

'vue/block-lang': ['error', { script: { lang: 'ts' } }],
'vue/block-order': ['error', { order: ['script[setup]', 'template', 'style[scoped]'] }],
'vue/component-api-style': ['error', ['script-setup']],
'vue/component-name-in-template-casing': 'error',
'vue/custom-event-name-casing': 'error',
'vue/define-emits-declaration': 'error',
'vue/define-macros-order': [
'error',
{
order: ['defineOptions', 'defineModel', 'defineProps', 'defineEmits', 'defineSlots'],
defineExposeLast: true,
},
],
'vue/define-props-declaration': 'error',
'vue/html-button-has-type': 'error',
'vue/no-multiple-objects-in-class': 'warn',
'vue/no-restricted-call-after-await': 'error',
'vue/no-template-target-blank': 'error',
'vue/no-unused-refs': 'warn',
'vue/no-use-v-else-with-v-for': 'error',
'vue/no-v-text': 'error',
'vue/padding-line-between-blocks': 'warn',
'vue/prefer-define-options': 'error',
'vue/prefer-separate-static-class': 'error',
'vue/prefer-true-attribute-shorthand': 'warn',
'vue/require-macro-variable-name': 'error',
'vue/require-typed-ref': 'warn',
'vue/v-for-delimiter-style': 'error',
'vue/valid-define-options': 'error',
},
},
// prettier
pluginPrettierRecommendedConfigs,
];
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@
"devDependencies": {
"@vue/eslint-config-prettier": "9.0.0",
"@vue/eslint-config-typescript": "13.0.0",
"eslint": "8.57.0",
"eslint": "9.6.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-vue": "9.26.0",
"prettier": "3.3.2"
"globals": "^15.6.0",
"prettier": "3.3.2",
"typescript-eslint": "^7.14.1",
"vue-eslint-parser": "^9.4.3"
}
}
Loading

0 comments on commit 28c1d12

Please sign in to comment.