vuejs / eslint-plugin-vue

Official ESLint plugin for Vue.js
https://eslint.vuejs.org/
MIT License
4.42k stars 660 forks source link

`vue/block-order` not only checks `.vue` but also `.ts` and `.js` files #2502

Open doorahmie opened 3 weeks ago

doorahmie commented 3 weeks ago

Is this normal operation? If so, what part should I fix? I think this rule should only apply to .vue files. Thanks for reading my question.

image

Here is my .eslintrc.js.

  root: true,
  env: {
    node: true,
  },
  extends: [
    "plugin:vue/vue3-essential",
    "eslint:recommended",
    "@vue/typescript/recommended",
    "plugin:prettier/recommended",
  ],
  parserOptions: {
    ecmaVersion: 2020,
  },
  rules: {
    "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
    "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
    "@typescript-eslint/no-explicit-any": "off",
    "no-unused-vars": "warn",
    "vue/attributes-order": "error",
    "vue/order-in-components": "error",
    "vue/block-order": ["warn", { order: ["template", "script", "style"] }],
  },
  overrides: [
    {
      files: [
        "**/__tests__/*.{j,t}s?(x)",
        "**/tests/unit/**/*.spec.{j,t}s?(x)",
      ],
      env: {
        jest: true,
      },
    },
  ],
};

and here is my tsconfig.json

{
  "compilerOptions": {
    "target": "esnext",
    "module": "esnext",
    "strict": true,
    "jsx": "preserve",
    "moduleResolution": "node",
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "forceConsistentCasingInFileNames": true,
    "useDefineForClassFields": true,
    "sourceMap": true,
    "baseUrl": ".",
    "types": ["webpack-env", "jest"],
    "lib": ["esnext", "dom", "dom.iterable", "scripthost"],
    "allowJs": true,
    "checkJs": false
  },
  "include": [
    "src/**/*.ts",
    "src/**/*.tsx",
    "src/**/*.vue",
    "tests/**/*.ts",
    "tests/**/*.tsx"
  ],
  "exclude": ["node_modules"]
}
doorahmie commented 3 weeks ago

the RED PATH means root path.

FloEdelmann commented 3 weeks ago

What is the @vue/typescript/recommended config? It looks similar to https://github.com/vuejs/eslint-config-typescript, but that one is only supported for @vue/cli & create-vue setups and is imported with @vue/eslint-config-typescript.

FloEdelmann commented 3 weeks ago

Please provide a Stackblitz or GitHub repo so we can debug the issue.