igorkowalski94 / eslint-plugin-project-structure Goto Github PK
View Code? Open in Web Editor NEWEslint plugin that allows you to enforce rules on project structure to keep your repository consistent even in large teams.
License: MIT License
Eslint plugin that allows you to enforce rules on project structure to keep your repository consistent even in large teams.
License: MIT License
Is your feature request related to a problem? Please describe.
I have project structure where some folders inside a module may not exists and it's ok. I can't describe such structure now
Describe the solution you'd like
Add a property to yaml/json setting on file/folder level (for example optional: true|false
) when setled to true there is no error if folder not exists
Additional context
version 1.4.7
Describe the bug
I'm testing a simple structure
#ls -la
.
app
public
components
- AbcXyz
- Aaa
- aa.tsx
- Abc.tsx
But i keep getting the eslint error at AbcXyz
To Reproduce
Expected behavior
AbcXyz should be correct structure
Add your projectStructure file
{
"$schema": "node_modules/eslint-plugin-project-structure/projectStructure.schema.json",
"structure": {
"children": [
{
"name": "public",
"children": []
},
{
"name": "app",
"children": [
{
"name": "globals",
"extension": "css"
},
{
"name": "/^(layout|page)$/",
"extension": "tsx"
},
{
"name": "favicon",
"extension": "ico"
}
]
},
{
"name": "components",
"children": [
{
"ruleId": "component_folder"
}
]
},
{
"extension": "*"
}
]
},
"rules": {
"component_folder": {
"name": "/^${{PascalCase}}$/"
}
}
}
** Operating system, Node.js an npm versions, and eslint version (please complete the following information):**
Additional context
Add any other context about the problem here.
Hello, first off thanks for this plugin!
I noticed when trying to configure a YML projectStructurerc file that it isn't being loaded. Looking at the code, I think the problem is here:
https://github.com/Igorkowalski94/eslint-plugin-project-structure/blob/main/src/validators/validateFileStructure/helpers/readConfigFile.ts#L12-L22
The YAML loader is falling through to the JSON loader on success rather than returning.
It should instead probably be something like:
let config = null;
try {
return load(readFileSync(configPath, "utf8"));
} catch (error) {
}
return JSON.parse(readFileSync(configPath, "utf-8"));
Happens in 1.4.7 (latest at the time of writing)
Describe the bug
index.test.ts is not considered kebab-case (double extension)
Expected behavior
index.test.ts should be considered kebab-case
someFileName.test.ts should not considered kebab-case
Additional context
There are legit cases where files may have more than one extension. What do you think about making it work like name.split(".")[0]?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.