This ESLint plugin allows you load project-scope ESLint rules.
npm i -D eslint-plugin-project
yarn add --dev eslint-plugin-project
You must put your rules definition files somewhere.
By default, this plugin will look up
For example, we put some rules in
eslint/rules of your current working directory.
Now we configure our ESLint config file like this:
That is, we tell the plugin to search the rules in
The path can be absulote or relative (to current working directory).
Note that the
projectRulesDir can be an array if you want to specify multiple directories.
Next enable this plugin in ESLint config file:
Now you can use your rules:
This plugin is inspired from
eslint-plugin-rulesdirisn't friendly for static ESLint config file. (You must use
eslint-plugin-rulesdirhas issue with Visual Studio Code integration. If you don't mind the format of ESLint config file and doesn't care about the integration with VS Code, you still can use this plugin, and
eslint-plugin-rulesdiris used in ESLint official repository.
eslint-plugin-local-rulesdoesn't allow you to customize your local rules path. And, you only can put all your rules in one file, which troubles project management.
MIT License (c) 2019-present Pig Fang