I've setup this proj: a folder with an invalid name contains two files. When linting, the folder is reported twice as not matching its rule.
$ find src/
src/
src/Bar
src/Bar/a.ts
src/Bar/b.ts
$ cat .eslintrc.yml
env:
es2021: true
node: true
overrides: [ ]
parser: '@typescript-eslint/parser'
parserOptions:
ecmaVersion: latest
sourceType: module
plugins:
- 'check-file'
rules: {
'check-file/folder-naming-convention': [ 'warn', { 'src/**': 'KEBAB_CASE' } ],
}
$ cat package.json
{
"name": "bar",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\""
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@typescript-eslint/parser": "^5.59.11",
"eslint": "^8.42.0",
"eslint-plugin-check-file": "^2.4.0",
"typescript": "^4.9.3",
"typescript-eslint": "^0.0.1-alpha.0"
}
}
$ npm run lint
> [email protected] lint
> eslint "{src,apps,libs,test}/**/*.ts"
C:\Users\amitd\AppData\Local\Temp\bar\src\Bar\a.ts
1:1 warning The folder "Bar" does not match the "KEBAB_CASE" pattern check-file/folder-naming-convention
C:\Users\amitd\AppData\Local\Temp\bar\src\Bar\b.ts
1:1 warning The folder "Bar" does not match the "KEBAB_CASE" pattern check-file/folder-naming-convention
โ 2 problems (0 errors, 2 warnings)