| 1 |
const path = require('path') |
| 2 |
const js = require('@eslint/js') |
| 3 |
const globals = require('globals') |
| 4 |
const vue = require('eslint-plugin-vue') |
| 5 |
const babelParser = require('@babel/eslint-parser') |
| 6 |
|
| 7 |
const babelParserOptions = { |
| 8 |
requireConfigFile: false, |
| 9 |
babelOptions: { |
| 10 |
configFile: path.join(__dirname, 'babel.config.js'), |
| 11 |
}, |
| 12 |
} |
| 13 |
|
| 14 |
module.exports = [ |
| 15 |
{ |
| 16 |
ignores: [ |
| 17 |
'deploy/**', |
| 18 |
'dist/**', |
| 19 |
'freemius/**', |
| 20 |
'local_modules/**', |
| 21 |
'node_modules/**', |
| 22 |
'src/pricing/**', |
| 23 |
'vendor/**', |
| 24 |
], |
| 25 |
}, |
| 26 |
{ |
| 27 |
...js.configs.recommended, |
| 28 |
files: ['src/**/*.js'], |
| 29 |
languageOptions: { |
| 30 |
...js.configs.recommended.languageOptions, |
| 31 |
ecmaVersion: 2018, |
| 32 |
sourceType: 'module', |
| 33 |
parser: babelParser, |
| 34 |
parserOptions: babelParserOptions, |
| 35 |
globals: { |
| 36 |
ajaxurl: 'readonly', |
| 37 |
...globals.browser, |
| 38 |
...globals.jquery, |
| 39 |
...globals.node, |
| 40 |
jQuery: 'readonly', |
| 41 |
}, |
| 42 |
}, |
| 43 |
}, |
| 44 |
...vue.configs['flat/vue2-recommended'].map((config) => ({ |
| 45 |
...config, |
| 46 |
files: ['src/**/*.vue'], |
| 47 |
languageOptions: { |
| 48 |
...config.languageOptions, |
| 49 |
ecmaVersion: 2018, |
| 50 |
sourceType: 'module', |
| 51 |
globals: { |
| 52 |
ajaxurl: 'readonly', |
| 53 |
...globals.browser, |
| 54 |
...globals.jquery, |
| 55 |
...globals.node, |
| 56 |
...(config.languageOptions?.globals || {}), |
| 57 |
jQuery: 'readonly', |
| 58 |
}, |
| 59 |
parserOptions: { |
| 60 |
...config.languageOptions?.parserOptions, |
| 61 |
...babelParserOptions, |
| 62 |
parser: babelParser, |
| 63 |
ecmaVersion: 2018, |
| 64 |
sourceType: 'module', |
| 65 |
}, |
| 66 |
}, |
| 67 |
})), |
| 68 |
{ |
| 69 |
files: ['src/**/*.{js,vue}'], |
| 70 |
rules: { |
| 71 |
'linebreak-style': ['error', 'unix'], |
| 72 |
'no-console': 'off', |
| 73 |
'no-prototype-builtins': 'off', |
| 74 |
'no-trailing-spaces': 'warn', |
| 75 |
'no-unused-vars': 'error', |
| 76 |
quotes: ['error', 'single'], |
| 77 |
semi: ['error', 'never'], |
| 78 |
'vue/attributes-order': 'off', |
| 79 |
'vue/first-attribute-linebreak': 'off', |
| 80 |
'vue/max-attributes-per-line': 'off', |
| 81 |
'vue/multi-word-component-names': 'off', |
| 82 |
'vue/no-mutating-props': 'off', |
| 83 |
'vue/no-reserved-component-names': 'off', |
| 84 |
'vue/no-v-text-v-html-on-component': 'off', |
| 85 |
'vue/require-prop-types': 'off', |
| 86 |
}, |
| 87 |
}, |
| 88 |
] |
| 89 |
|