Skip to content
This repository has been archived by the owner on Dec 25, 2023. It is now read-only.

How to set options.rulePaths or --rulesdir #68

Closed
markholland opened this issue Jan 14, 2021 · 7 comments · Fixed by #75
Closed

How to set options.rulePaths or --rulesdir #68

markholland opened this issue Jan 14, 2021 · 7 comments · Fixed by #75
Labels
enhancement New feature or request

Comments

@markholland
Copy link

Our project has some rules we created and they are stored in a specific location.

I need a way to provide this path through either the options object or eslint arguments.

Can this be accomplished using this plugin?

@markholland markholland added the enhancement New feature or request label Jan 14, 2021
@jbree
Copy link

jbree commented Jan 14, 2021

You can go to Project > Project Settings…, find ESLint in the Extensions section on the side, then set the "Path to ESLint configuration".

If you'd prefer a global setting, look in Extensions > Extension Library…, find ESLint, then go to the Preferences tab to find a global version of the same setting.

@markholland
Copy link
Author

I might be misunderstanding but I still want ESLint to use the project .eslintrc.js configuration file which is where the custom rules are enabled. I haven't seen a way to set additional rules directories in a configuration file, we have to pass it as a cli argument like so eslint . --rulesdir=.eslint/rules

@jbree
Copy link

jbree commented Jan 15, 2021

Ah sorry, my misunderstanding. I assumed you were talking about configuration files 🤦🏻‍♂️

@apexskier
Copy link
Owner

apexskier commented Jan 19, 2021

Nova 4 has a new feature I've been hoping for that might help with this. I can now add preferences that are arrays of paths. I'm thinking about adding a preference for "Additional eslint arguments" that you can use to set things like this.

@apexskier
Copy link
Owner

apexskier commented Jan 19, 2021

Alternatively, this could be supported in the same way a custom config file is supported -

{
"key": "apexskier.eslint.config.eslintConfigPath",
"title": "Path to ESLint configuration",
"type": "path"
}
, which aligns with how a custom binary is supported. A downside to that is that it doesn't support multiple values.

The only downside to using a string array is that you don't get the nice directory picker UI

@apexskier
Copy link
Owner

#75 adds a config option for adding custom rules dirs. It appears there's a Nova bug preventing the preference from appearing globally when I restrict it to folders, but the workspace preference seems to work file. I'd appreciate someone trying it out locally before I merge and publish, since I don't usually use custom rules directories.

apexskier added a commit that referenced this issue Jan 25, 2021
* Add support for custom rules dirs

Resolves #68

* Changelog

* Add a bunch of test files for custom rules

* Work around directory mangling issue

* add link to eslint config docs

* Improve console output when linting fails

* changelog

* format
@github-actions
Copy link

Included in release v1.7.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants