@fc3/eslint-plugin
v0.1.1
Published
Custom ESLint rules and the shared lint configuration for @fc3 projects
Readme
@fc3/eslint-plugin
Custom ESLint rules and the shared lint configuration for @fc3 projects.
Usage
Install the plugin alongside ESLint:
npm install --save-dev eslint @fc3/eslint-pluginThen make it your eslint.config.mjs:
import FC3 from '@fc3/eslint-plugin';
export default FC3.configs.recommended;The recommended config bundles @eslint/js recommended, typescript-eslint
recommended, eslint-config-prettier, the shared naming and unused-variable
rules used across @fc3 projects, and every rule in this plugin. To use only
the rules, register the plugin yourself:
import FC3 from '@fc3/eslint-plugin';
export default [
{
plugins: {'@fc3': FC3},
rules: {'@fc3/import-order': 'error'}
}
];Rules
@fc3/import-order
Imports at the top of a file must be grouped, in this order:
- Node core modules (
fs,path,node:http) - Third-party modules (
eslint,formidable) - First-party modules (anything under
@fc3) - Local modules, resolved against
src/from the project root
Each group is separated from the next by exactly one blank line. Within a
group, imports are sorted by the length of their specifiers, so that the
imported names form an ascending staircase. Local imports must use the
project's baseUrl style absolute path rather than a relative one.
The rule is auto-fixable: eslint --fix rewrites the whole import block into
the expected order.
Development
npm install
./bin/test
./bin/lint