At first hello, and thank you for creating such a nice plugin!
Describe the bug
I want to apply "**/*.{js,ts}": "KEBAB_CASE", rule with "ignoreMiddleExtensions": true,
plus 1 custom rule for the specific folder:
"**/*/dtos/enums/*.{js,ts}": "*.enum*" (all files in this folder must have specific name, for instance: 'auth.dto.enum.ts')
when I apply the second rule with the "**/*/dtos/enums/*.{js,ts}": "*.enum*", it doesn't work.
Error:
src/modules/example/dtos/enums/example.dto.enum.ts 1:1 error The file "example.dto.enum.ts" does not match file naming convention defined("*.enum*") for this project. check-file/filename-naming-convention
It starts working when I set 'ignoreMiddleExtensions' to false, but I need it to keep enabled, to keep "**/*.{js,ts}": "KEBAB_CASE", rule working fine because of the way how we name files:
user.util.spec.ts
user.dto.enum.ts
etc.
Expected behavior
I need to apply a custom rule, where 'ignoreMiddleExtensions' setting will be ignored.
Or maybe I need somehow re-write 'KEBAB_CASE' rule to make it working w/o switching on 'ignoreMiddleExtensions'??
Plugin configuration "check-file/filename-naming-convention": [ "error", { "**/*.{js,ts}": "KEBAB_CASE", "**/*/dtos/enums/*.{js,ts}": "*.enum*" }, { "ignoreMiddleExtensions": true, "errorMessage": "The file \"{{ target }}\" does not match file naming convention defined(\"{{ pattern }}\") for this project. See README.md for details" } ],
Project structure
If applicable, add a minimal reproducible project structure generated by the tree cmd like the one below.
.
├── basics/ # some global logic that is used across multiple modules/places/
│ ├── dtos/ only global dto logic that doesn't belong to any module
│ ├── constants/
│ │ └── user.constant.ts
│ ├── generators/
│ │ └── user.generator.ts
│ ├── mocks/
│ │ └── user.mock.ts
│ ├── types/
│ │ └── user.type.ts
│ ├── enums/
│ │ └── user.enum.ts
│ └── utils/
│ ├── tests/
│ │ └── user.util.spec.ts
│ └── user.util.ts
├── core/ # Some global logic that could be used anywhere/
│ ├── config/ # Configuration module which we'll be able to re-use all across modules
│ ├── database/ # Database providers and configuration (TypeORM, Mongoose, etc.)
│ ├── cache/ # Caching mechanisms (e.g., Redis)
│ ├── logging/ # Logging services and configurations
│ ├── middleware/ # Global middleware
│ ├── services/ # Global services that don't fit into specific modules
│ └── gateways/
├── dtos/
│ ├── constants/
│ │ └── user.dto.constant.ts
│ ├── types/
│ │ └── user.dto.type.ts
│ ├── enums/
│ │ └── user.dto.enum.ts
│ ├── generators/
│ │ └── user.dto.generator.ts
│ ├── mocks/
│ │ └── user.dto.mock.ts
│ ├── parsers/
│ │ └── user.dto.parser.ts
│ ├── validators/
│ │ └── user.dto.validator.ts
│ └── transformers/
│ └── user.dto.transformer.ts
├── -----------
├── apps/
│ ├── app1/
│ ├── app2/
│ │ └── src/
│ │ ├── main.ts
│ │ ├── app.module.ts
│ │ ├── basics/
│ │ └── core/ # Some core functionality that we'll just switch on in the app.module
│ └── ...
└── libs/
├── core/. # we do no bind this folder to the structure above/
│ └── ...
├── shared-library/
│ └── src/
│ ├── basics/
│ ├── core/
│ └── ...
└── modules/
├── shared/
│ └── shared-module-across-apps/
│ └── src/
│ ├── modules/
│ ├── basics/
│ └── core/
├── app1/
│ └── src/
│ ├── modules/
│ ├── basics/
│ └── core/
└── app2/
├── region1/
│ └── src/
│ ├── modules/
│ │ └── auth/
│ │ ├── tests/
│ │ │ └── auth.controller.spec.ts
│ │ ├── auth.controller.ts # Controllers for authentication
│ │ ├── dtos/ # DTOs specific to the
│ │ ├── auth.types.ts # Types for the auth module
│ │ ├── auth.module.ts
│ │ ├── auth.service.ts
│ │ └── ...
│ ├── basics/
│ └── core/
├── region2/
│ └── src/
│ ├── modules/
│ │ └── ...
│ ├── basics/
│ └── core/
└── shared/ # This code can be shared across different modules/
└── src/
├── modules/
│ └── ...
├── basics/
└── core/
Desktop (please complete the following information):
ignoreMiddleExtensions can't be supported in your case, it will enable for all rules in filename-naming-convention, you need to use a custom glob expression in your case.
At first hello, and thank you for creating such a nice plugin!
Describe the bug I want to apply
"**/*.{js,ts}": "KEBAB_CASE",
rule with"ignoreMiddleExtensions": true,
plus 1 custom rule for the specific folder:"**/*/dtos/enums/*.{js,ts}": "*.enum*"
(all files in this folder must have specific name, for instance: 'auth.dto.enum.ts')when I apply the second rule with the
"**/*/dtos/enums/*.{js,ts}": "*.enum*"
, it doesn't work. Error:src/modules/example/dtos/enums/example.dto.enum.ts 1:1 error The file "example.dto.enum.ts" does not match file naming convention defined("*.enum*") for this project. check-file/filename-naming-convention
It starts working when I set 'ignoreMiddleExtensions' to false, but I need it to keep enabled, to keep
"**/*.{js,ts}": "KEBAB_CASE",
rule working fine because of the way how we name files:Expected behavior I need to apply a custom rule, where 'ignoreMiddleExtensions' setting will be ignored. Or maybe I need somehow re-write 'KEBAB_CASE' rule to make it working w/o switching on 'ignoreMiddleExtensions'??
Plugin configuration
"check-file/filename-naming-convention": [ "error", { "**/*.{js,ts}": "KEBAB_CASE", "**/*/dtos/enums/*.{js,ts}": "*.enum*" }, { "ignoreMiddleExtensions": true, "errorMessage": "The file \"{{ target }}\" does not match file naming convention defined(\"{{ pattern }}\") for this project. See README.md for details" } ],
Project structure If applicable, add a minimal reproducible project structure generated by the
tree
cmd like the one below.Desktop (please complete the following information):