Skip to content

Commit

Permalink
feat(eslint): update to v9 (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
webdevnerdstuff authored Nov 6, 2024
1 parent 9af9a32 commit 4132a30
Show file tree
Hide file tree
Showing 4 changed files with 2,653 additions and 2,643 deletions.
196 changes: 103 additions & 93 deletions index.cjs
Original file line number Diff line number Diff line change
@@ -1,97 +1,107 @@
module.exports = {
root: true,
env: {
node: true,
},
extends: [
'plugin:vue/vue3-recommended',
'standard',
'@vue/eslint-config-typescript',
],
rules: {
'no-var': 'error',
// allow paren-less arrow functions
'arrow-parens': ['error', 'as-needed'],
complexity: ['error', 32],
quotes: ['error', 'single', {
avoidEscape: true,
allowTemplateLiterals: true,
}],
'no-console': 'off',
'comma-dangle': ['error', {
arrays: 'always-multiline',
objects: 'always-multiline',
imports: 'always-multiline',
exports: 'always-multiline',
functions: 'only-multiline',
}],
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-return-assign': 'off',
'no-unused-vars': 'error',
'no-empty': 'error',
'array-bracket-spacing': ['error', 'never'],
'object-curly-spacing': ['error', 'always'],
'space-before-function-paren': [
'error',
{
anonymous: 'always',
named: 'always',
asyncArrow: 'always',
import pluginVue from 'eslint-plugin-vue';
import globals from 'globals';
import vueTsEslintConfig from '@vue/eslint-config-typescript'

export default [
...pluginVue.configs['flat/essential'],
...vueTsEslintConfig(),
{
name: 'app/files-to-lint',
files: ['**/*.{js,mjs,jsx,ts,mts,tsx,vue}'],
languageOptions: {
globals: {
...globals.node,
},
],
'no-return-await': 'warn',
'object-shorthand': ['error', 'always'],
'no-extra-semi': 'error',
'prefer-const': ['error', {
destructuring: 'all',
ignoreReadBeforeAssign: true,
}],
'no-prototype-builtins': 'off',
'no-void': 'off',
'no-case-declarations': 'off',
'sort-imports': ['warn', {
ignoreDeclarationSort: true,
ignoreCase: true,
}],
'multiline-ternary': 'off',
},
rules: {
'array-bracket-spacing': ['error', 'never'],
// allow paren-less arrow functions
'arrow-parens': ['error', 'as-needed'],
complexity: ['error', 32],
'no-console': 'off',
'comma-dangle': ['error', {
arrays: 'always-multiline',
objects: 'always-multiline',
imports: 'always-multiline',
exports: 'always-multiline',
functions: 'only-multiline',
}],
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-empty': 'error',
'no-return-assign': 'off',
'no-return-await': 'warn',
'object-shorthand': ['error', 'always'],
'no-extra-semi': 'error',
'no-case-declarations': 'off',
'no-prototype-builtins': 'off',
'no-unused-vars': 'error',
'no-var': 'error',
'no-void': 'off',
'multiline-ternary': 'off',
'object-curly-spacing': ['error', 'always'],
'prefer-const': ['error', {
destructuring: 'all',
ignoreReadBeforeAssign: true,
}],
'prefer-const': ['error', {
destructuring: 'all',
ignoreReadBeforeAssign: true,
}],
quotes: ['error', 'single', {
avoidEscape: true,
allowTemplateLiterals: true,
}],

// Not in override, these apply to non-.vue files too
'vue/require-default-prop': 'off',
'vue/require-prop-types': 'off',
'vue/one-component-per-file': 'off',
'vue/custom-event-name-casing': ['error', { ignores: ['/^[a-z]+(?:-[a-z]+)*:[a-z]+(?:-[a-z]+)*$/u'] }],
'sort-imports': ['warn', {
ignoreDeclarationSort: true,
ignoreCase: true,
}],
'space-before-function-paren': [
'error',
{
anonymous: 'always',
named: 'always',
asyncArrow: 'always',
},
],

'vue/attributes-order': ['error', {
alphabetical: true,
}],
// Not in override, these apply to non-.vue files too
'vue/attributes-order': ['error', {
alphabetical: true,
}],
'vue/one-component-per-file': 'off',
'vue/custom-event-name-casing': ['error', { ignores: ['/^[a-z]+(?:-[a-z]+)*:[a-z]+(?:-[a-z]+)*$/u'] }],
'vue/require-default-prop': 'off',
'vue/require-prop-types': 'off',
}
},
overrides: [
{
files: '**/*.vue',
rules: {
indent: 'off',
'vue/script-indent': ['error', 2, {
baseIndent: 1,
switchCase: 1,
ignores: [],
}],
'vue/html-closing-bracket-newline': ['error', {
singleline: 'never',
multiline: 'always',
}],
'vue/html-closing-bracket-spacing': 'error',
'vue/max-attributes-per-line': ['error', {
singleline: 4,
multiline: 1,
}],
'vue/valid-v-on': 'off', // This rule doesn't allow empty event listeners
'vue/no-v-html': 'off',
'vue/singleline-html-element-content-newline': 'off',
'vue/multiline-html-element-content-newline': 'off',
'vue/valid-v-slot': ['error', { allowModifiers: true }],
'vue/multi-word-component-names': 'off',
},
},
],
}

{
name: 'app/overrides',
files: '**/*.vue',
rules: {
indent: 'off',
'vue/html-closing-bracket-newline': ['error', {
singleline: 'never',
multiline: 'always',
}],
'vue/html-closing-bracket-spacing': 'error',
'vue/no-v-html': 'off',
'vue/max-attributes-per-line': ['error', {
singleline: 4,
multiline: 1,
}],
'vue/multi-word-component-names': 'off',
'vue/multiline-html-element-content-newline': 'off',
'vue/script-indent': ['error', 2, {
baseIndent: 1,
switchCase: 1,
ignores: [],
}],
'vue/singleline-html-element-content-newline': 'off',
'vue/valid-v-on': 'off', // This rule doesn't allow empty event listeners
'vue/valid-v-slot': ['error', { allowModifiers: true }],
}
}
]
20 changes: 11 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,22 @@
"author": "John Leider <[email protected]>",
"license": "MIT",
"peerDependencies": {
"eslint": "^8.57.0",
"eslint-plugin-n": "^16.0.0"
"eslint": "^9.14.0",
"eslint-plugin-n": "^17.12.0"
},
"dependencies": {
"babel-eslint": "^10.1.0",
"eslint": "^8.57.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint": "^9.14.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-standard": "^4.1.0",
"eslint-plugin-vue": "^9.23.0",
"eslint-plugin-promise": "^7.1.0",
"eslint-plugin-vue": "^9.29.0",
"eslint-plugin-vuetify": "^2.2.0",
"vue": "^3.4.21",
"globals": "^15.12.0",
"vue": "^3.4.31",
"vuetify": "^3.5.9"
},
"devDependencies": {
"@vue/eslint-config-typescript": "^14.1.3"
}
}
Loading

0 comments on commit 4132a30

Please sign in to comment.