Eslint tries to lint non-existing/phantom files? #18162
-
eslint.config.js// @ts-check
import globals from "globals";
import path from 'path';
import { fileURLToPath } from 'url';
import { FlatCompat } from '@eslint/eslintrc';
import eslint from "@eslint/js";
import tseslint from 'typescript-eslint';
import vueEslintParser from "vue-eslint-parser";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const eslintrc = new FlatCompat({
baseDirectory: __dirname
})
export default tseslint.config(
{
ignores: ["node_modules", "coverage", ".nyc_output", "dist"],
},
eslint.configs.recommended,
...tseslint.configs.recommended,
...eslintrc.plugins('vue'),
...eslintrc.extends('plugin:vue/vue3-recommended'),
{
languageOptions: {
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
extraFileExtensions: ['.vue'],
parser: tseslint.parser,
sourceType: "module",
},
ecmaVersion: 2022,
sourceType: "module",
globals: {
...globals.browser,
},
parser: vueEslintParser,
},
files: ["src/**/*.ts", "src/**/*.vue", "tests/**/*.ts"],
rules: {
"vue/multi-word-component-names": [
"error",
{
ignores: ["Button", "Footer", "User"],
},
],
"@typescript-eslint/no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
},
],
},
},
); package.json
tsconfig.json{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"module": "NodeNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,
"moduleResolution": "NodeNext",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve",
"strict": true,
"strictNullChecks": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src/**/*.ts", "src/**/*.vue", "tests/**/*.ts"],
"references": [{ "path": "./tsconfig.node.json" }]
} For some reason, eslint is picking up these phantom files. I don't understand why. Results:
|
Beta Was this translation helpful? Give feedback.
Answered by
mdjermanovic
Mar 2, 2024
Replies: 1 comment 1 reply
-
Looks like all those files are dotfiles (files starting with -ignores: ["node_modules", "coverage", ".nyc_output", "dist"],
+ignores: ["node_modules", "coverage", ".nyc_output", "dist", "**/.*"], |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Lilja
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looks like all those files are dotfiles (files starting with
.
). In flat config, dotfiles are not ignored by default. If you want eslint to skip linting dotfiles, you can add ignore pattern"**/.*"
: