157 lines
4.9 KiB
JavaScript
157 lines
4.9 KiB
JavaScript
import js from '@eslint/js'
|
|
import globals from 'globals'
|
|
import pluginVue from 'eslint-plugin-vue'
|
|
import pluginQuasar from '@quasar/app-vite/eslint'
|
|
import vueTsEslintConfig from '@vue/eslint-config-typescript'
|
|
import prettierSkipFormatting from '@vue/eslint-config-prettier/skip-formatting'
|
|
|
|
export default [
|
|
{
|
|
/**
|
|
* Ignore the following files.
|
|
* Please note that pluginQuasar.configs.recommended() already ignores
|
|
* the "node_modules" folder for you (and all other Quasar project
|
|
* relevant folders and files).
|
|
*
|
|
* ESLint requires "ignores" key to be the only one in this object
|
|
*/
|
|
ignores: ['src/js/*', 'scripts/*', 'src/common/*'] // <<<---- here!
|
|
},
|
|
|
|
...pluginQuasar.configs.recommended(),
|
|
js.configs.recommended,
|
|
|
|
/**
|
|
* https://eslint.vuejs.org
|
|
*
|
|
* pluginVue.configs.base
|
|
* -> Settings and rules to enable correct ESLint parsing.
|
|
* pluginVue.configs[ 'flat/essential']
|
|
* -> base, plus rules to prevent errors or unintended behavior.
|
|
* pluginVue.configs["flat/strongly-recommended"]
|
|
* -> Above, plus rules to considerably improve code readability and/or dev experience.
|
|
* pluginVue.configs["flat/recommended"]
|
|
* -> Above, plus rules to enforce subjective community defaults to ensure consistency.
|
|
*/
|
|
...pluginVue.configs['flat/essential'],
|
|
|
|
{
|
|
files: ['**/*.ts', '**/*.vue'],
|
|
rules: {
|
|
'@typescript-eslint/consistent-type-imports': [
|
|
'error',
|
|
{ prefer: 'type-imports' },
|
|
]
|
|
}
|
|
},
|
|
// https://github.com/vuejs/eslint-config-typescript
|
|
...vueTsEslintConfig({
|
|
extends: [
|
|
'recommended' // Meno restrittivo di 'recommendedTypeChecked'
|
|
],
|
|
}),
|
|
|
|
{
|
|
languageOptions: {
|
|
ecmaVersion: 'latest',
|
|
sourceType: 'module',
|
|
|
|
globals: {
|
|
...globals.browser,
|
|
...globals.node, // SSR, Electron, config files
|
|
process: 'readonly', // import.meta.env.*
|
|
ga: 'readonly', // Google Analytics
|
|
cordova: 'readonly',
|
|
Capacitor: 'readonly',
|
|
chrome: 'readonly', // BEX related
|
|
browser: 'readonly' // BEX related
|
|
}
|
|
},
|
|
|
|
// add your custom rules here
|
|
rules: {
|
|
'generator-star-spacing': 'off',
|
|
// allow paren-less arrow functions
|
|
'arrow-parens': 'off',
|
|
'no-loop-func': 'off',
|
|
'one-var': 'off',
|
|
'no-void': 'off',
|
|
'comma-dangle': 'off',
|
|
// 'comma-dangle': [2, 'always-multiline'],
|
|
// 'multiline-ternary': 'off',
|
|
'prefer-promise-reject-errors': 'off',
|
|
'no-bitwise': 'off',
|
|
'no-console': 'off',
|
|
'no-restricted-syntax': 'off',
|
|
'no-param-reassign': 'off',
|
|
'no-plusplus': 'off',
|
|
|
|
'no-useless-escape': 'off',
|
|
'no-constant-condition': 'off',
|
|
|
|
// TypeScript
|
|
quotes: ['warn', 'single', { avoidEscape: true }],
|
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
'@typescript-eslint/semi': 'off',
|
|
'@typescript-eslint/object-curly-spacing': 'off',
|
|
'@typescript-eslint/restrict-plus-operands': 'off',
|
|
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
|
|
|
|
'@typescript-eslint/no-unsafe-assignment': 'off',
|
|
'@typescript-eslint/no-unsafe-member-access': 'off',
|
|
'@typescript-eslint/no-unsafe-call': 'off',
|
|
'@typescript-eslint/no-unsafe-return': 'off',
|
|
'@typescript-eslint/no-unsafe-argument': 'off',
|
|
|
|
// allow debugger during development only
|
|
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
|
|
|
'max-classes-per-file': 'off',
|
|
'no-useless-constructor': 'off',
|
|
'no-empty-function': 'off',
|
|
'no-empty': 'off',
|
|
'@typescript-eslint/no-useless-constructor': 'error',
|
|
'import/prefer-default-export': 'off',
|
|
'no-use-before-define': 'off',
|
|
'@typescript-eslint/no-unused-vars': 'off',
|
|
'@typescript-eslint/max-len': 'off',
|
|
'max-len': 'off',
|
|
'@typescript-eslint/naming-convention': 'off',
|
|
'no-underscore-dangle': 'off',
|
|
'@typescript-eslint/restrict-template-expressions': 'off',
|
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
'@typescript-eslint/ban-ts-comment': 'off',
|
|
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
'@typescript-eslint/no-floating-promises': 'off',
|
|
'prefer-const': 'off',
|
|
'no-extra-boolean-cast': 'off',
|
|
'max-attributes-per-line': 'off',
|
|
'vue/max-attributes-per-line': [
|
|
'warn', { // Cambia da 'error' a 'warn'
|
|
'singleline': 15,
|
|
'multiline': 15
|
|
}
|
|
],
|
|
'vue/no-v-model-argument': 'off',
|
|
'vue/multi-word-component-names': 'off',
|
|
'import/first': 'off',
|
|
'import/named': 'off',
|
|
'import/no-unresolved': 'off',
|
|
'import/no-extraneous-dependencies': 'off',
|
|
}
|
|
},
|
|
|
|
{
|
|
files: ['src-pwa/custom-service-worker.ts'],
|
|
languageOptions: {
|
|
globals: {
|
|
...globals.serviceworker
|
|
}
|
|
}
|
|
},
|
|
|
|
prettierSkipFormatting
|
|
]
|
|
|