|
| 1 | +const webpackConfigPath = require.resolve("@vue/cli-service/webpack.config.js"); |
| 2 | + |
1 | 3 | module.exports = {
|
2 | 4 | root: true,
|
3 | 5 | env: {
|
4 | 6 | browser: true,
|
5 | 7 | node: true,
|
6 | 8 | es2020: true,
|
7 | 9 | },
|
8 |
| - extends: ["plugin:vue/vue3-essential", "@vue/airbnb", "@vue/typescript/recommended", "plugin:prettier-vue/recommended", "prettier"], |
9 | 10 | parserOptions: {
|
10 | 11 | ecmaVersion: 2020,
|
11 | 12 | },
|
| 13 | + extends: [ |
| 14 | + // Vue-specific defaults |
| 15 | + "plugin:vue/vue3-essential", |
| 16 | + // Vue-compatible JS defaults |
| 17 | + "@vue/airbnb", |
| 18 | + // Vue-compatible TS defaults |
| 19 | + "@vue/typescript/recommended", |
| 20 | + // Vue-compatible Prettier defaults |
| 21 | + "plugin:prettier-vue/recommended", |
| 22 | + // General Prettier defaults |
| 23 | + "prettier", |
| 24 | + ], |
12 | 25 | settings: {
|
| 26 | + // https://github.com/import-js/eslint-plugin-import#resolvers |
13 | 27 | "import/resolver": {
|
14 | 28 | // `node` must be listed first!
|
15 | 29 | node: {},
|
16 |
| - webpack: { config: require.resolve("@vue/cli-service/webpack.config.js") }, |
| 30 | + webpack: { config: webpackConfigPath }, |
17 | 31 | },
|
| 32 | + |
| 33 | + // https://github.com/meteorlxy/eslint-plugin-prettier-vue |
18 | 34 | "prettier-vue": {
|
| 35 | + // Use Prettier to format the HTML, CSS, and JS blocks of .vue single-file components |
19 | 36 | SFCBlocks: {
|
20 | 37 | template: true,
|
21 | 38 | style: true,
|
| 39 | + script: true, |
22 | 40 | },
|
23 | 41 | },
|
24 | 42 | },
|
25 |
| - ignorePatterns: ["node_modules/", "dist/", "pkg/", "wasm/pkg/*", "!.*.js", "!.*.ts", "!.*.json"], |
| 43 | + ignorePatterns: [ |
| 44 | + // Ignore generated directories |
| 45 | + "node_modules/", |
| 46 | + "dist/", |
| 47 | + "pkg/", |
| 48 | + "wasm/pkg/", |
| 49 | + |
| 50 | + // Don't ignore JS and TS dotfiles in this folder |
| 51 | + "!.*.js", |
| 52 | + "!.*.ts", |
| 53 | + ], |
26 | 54 | rules: {
|
| 55 | + // Standard ESLint config |
27 | 56 | indent: ["error", "tab", { SwitchCase: 1 }],
|
28 | 57 | quotes: ["error", "double"],
|
| 58 | + camelcase: ["error", { properties: "always" }], |
29 | 59 | "linebreak-style": ["error", "unix"],
|
30 | 60 | "eol-last": ["error", "always"],
|
| 61 | + "max-len": ["error", { code: 200, tabWidth: 4 }], |
31 | 62 | "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
|
32 | 63 | "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
|
33 | 64 | "no-param-reassign": ["error", { props: false }],
|
34 |
| - "import/prefer-default-export": "off", |
35 |
| - "max-len": ["error", { code: 200, tabWidth: 4 }], |
| 65 | + |
| 66 | + // TypeScript plugin config |
36 | 67 | "@typescript-eslint/camelcase": "off",
|
37 | 68 | "@typescript-eslint/no-use-before-define": "off",
|
38 | 69 | "@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
|
39 |
| - camelcase: ["error", { properties: "always" }], |
| 70 | + |
| 71 | + // Import plugin config (used to intelligently validate module import statements) |
| 72 | + "import/prefer-default-export": "off", |
| 73 | + |
| 74 | + // Prettier plugin config (used to enforce HTML, CSS, and JS formatting styles as an ESLint plugin, where fixes are reported to ESLint to be applied when linting) |
40 | 75 | "prettier-vue/prettier": [
|
41 | 76 | "error",
|
42 | 77 | {
|
|
0 commit comments