Git Product home page Git Product logo

igorkowalski94 / eslint-plugin-project-structure Goto Github PK

View Code? Open in Web Editor NEW
131.0 2.0 2.0 685 KB

Eslint plugin that allows you to enforce rules on project structure to keep your repository consistent even in large teams.

License: MIT License

JavaScript 5.17% TypeScript 92.55% Shell 2.28%
eslint eslint-plugin folder-structure file-structure project-structure file-validation file-structure-rules folder-structure-rules force-file-structure force-folder-structure

eslint-plugin-project-structure's People

Contributors

igorkowalski94 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

eslint-plugin-project-structure's Issues

Make folder optional

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

Simple rule for components/AbcXyz not working

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

Screenshot 2023-08-30 at 09 40 03

Screenshot 2023-08-30 at 09 40 12
Screenshot 2023-08-30 at 09 40 22

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.

YAML config isn't being read properly

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"));

[BUG] kebab case fails with double extension

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]?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.