FPCS eslint style rules.
yarn add --dev eslint-plugin-fpcs
- Install peer dependencies. Most of the peer dependencies on this package are optional, only required for certain platforms.
- Install required peer deps for base config:
npx check-peer-dependencies --yarn --install
- If you are using Babel, install Babel peer deps:
yarn add --dev @babel/eslint-parser@^7.22.15 [email protected]
- If you are using Typescript, install Typescript peer deps:
yarn add --dev @typescript-eslint/[email protected] @typescript-eslint/[email protected] [email protected]
- If you are using React, install React peer deps:
yarn add --dev [email protected] [email protected] [email protected] [email protected]
- If you are using Vue, install Vue peer deps:
yarn add --dev [email protected]
- Confirm peer deps for peace of mind:
npx check-peer-dependencies --yarn
- Install required peer deps for base config:
- Update your project's package.json devDependencies to use
"eslint-plugin-fpcs": "^2.0.0"
- Run
yarn
- Follow "Install peer dependencies" instruction from "Installation" section above.
If you use babel, you will need to add "plugin:fpcs/babel"
to the extends
section of your .eslintrc file. Make sure to place it directly after base
, before any other configs like typescript or react.
FPCS has decided to move to always using named exports. See discussion in style guide.
To use v2 you will need to do one of the following:
- Change all default exports to named exports in your codebase.
- Add
eslint-disable import/no-default-export
for every default export in your codebase. - Add the following to your codebase's .eslintrc file:
rules: {
'import/no-default-export': 'off',
'import/prefer-default-export': 'warn',
'no-restricted-exports': 'off',
}
Alternatively, you may stay on v1.x, but future updates may not be applied to the v1.x tree.
Add desired config sets to the extends
section of your .eslintrc
or .eslintrc.js
configuration file.
plugin:fpcs/base
plugin:fpcs/babel
plugin:fpcs/react
plugin:fpcs/react-typescript
plugin:fpcs/typescript
plugin:fpcs/vue
{
"extends": [ "plugin:fpcs/base" ],
}
{
"extends": [
"plugin:fpcs/base",
"plugin:fpcs/typescript",
],
}
{
"extends": [
"plugin:fpcs/base",
"plugin:fpcs/react",
],
}
{
"extends": [
"plugin:fpcs/base",
"plugin:fpcs/react-typescript",
],
}
{
"extends": [
"plugin:fpcs/base",
"plugin:fpcs/vue",
],
}
Typically used on a React app that gets transpiled by babel.
{
"extends": [
"plugin:fpcs/base",
"plugin:fpcs/babel",
...if you extend other configs place them here, AFTER babel...
],
}
Add desired config sets to the rules
section of your .eslintrc
or .eslintrc.js
configuration file.
"rules": {
"@typescript-eslint/consistent-type-assertions": "off",
},
fpcs/no-gremlin-chars
(automatically set to 'error' when using base config)fpcs/prefer-early-return
(automatically set to 'error' when using base config)
To develop on this package, I strongly recommended that you use yalc. Yalc solves issues related to peer dependencies not symlinking correctly when using yarn link
on local. Just run yalc publish
in this repo and then yalc add eslint-plugin-fpcs && yarn
in the user repo after every change.