Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be able to use rulesDirectory #35

Closed
michaeljota opened this issue Jul 15, 2017 · 6 comments
Closed

Be able to use rulesDirectory #35

michaeljota opened this issue Jul 15, 2017 · 6 comments

Comments

@michaeljota
Copy link

Right now I tested with lastes tslint and this, but though there is not errors telling it does not find the rules directory, there is not definitions for the rules either.

@jonaskello
Copy link
Owner

I use it like this:

{
  "extends": [
    "tslint-immutable"
  ]
}

Could you post the relevant parts of your tslint.json file?

@michaeljota
Copy link
Author

I have it like this:

{
  "extends": [
    "./../../../node_modules/tslint-immutable"
  ],
  "rules": {
    "readonly-keyword": true,
    "readonly-array": true,
    "no-let": true
  }
}

But there is a new feature in tslint, rulesDirectory. It does not matter where folder are you, tslint will resolve the path into a node_module.

{
  "rulesDirectory": [
    "tslint-consistent-codestyle"
  ],
  "rules": {
    "early-exit": [
      true,
      {
        "max-length": 0
      }
    ]
  }
}

Both files are in the same sub-folder, but tslint-consistent-codestyle support for rulesDirectory.

@jonaskello
Copy link
Owner

According to the docs, both rulesDirectory and extends uses "node module resolution semantics". Could you try it with extends and just tslint-immutable without any path, like I posted above?

@jonaskello
Copy link
Owner

jonaskello commented Jul 15, 2017

Looked closer at the docs and for rulesDirectory it says "These values are handled using node module resolution semantics, if an index.js is placed in your rules directory.". So I added an index file. I'll publish it and we'll see if it works.

@jonaskello
Copy link
Owner

@michaeljota I published 4.0.2 which has an index.js file in the rules directory. Could you check if it works with rulesDirectory without patht?

@michaeljota
Copy link
Author

It works. Thanks you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants