@osedea/eslint-config v7.1.0
eslint config osedea
Peer dependencies
eslint >= 7.30 is a requirement. See external dependencies list below.
Configuring rules for project
@osedea/eslint-config comes with the following environments, some of which are already pre-configured, however you can mix-and-match the environments if you want.
| Config name | Extends | External Dependencies (besides eslint) |
|---|---|---|
| cypress | cypress | |
| es5 | ||
| esnext | es5 | |
| flow | flow-bin | |
| jest | jest, jest-dom, testing-library | |
| mocha | mocha | |
| node | esnext, mocha | |
| prettier | prettier | |
| react | esnext | |
| react-native | react | |
| typescript | esnext | typescript |
Create a file called .eslintrc.yml in the root of your project. Here, you will specify your rules, and extend one (or more) of the above rulesets.
Some example .eslintrc.yml configs:
extends:
- '@osedea/eslint-config/react' # extends other configs, see above
- '@osedea/eslint-config/typescript'
- '@osedea/eslint-config/prettier' # always needs to be lastextends:
- '@osedea/eslint-config/react-native' # extends other configs, see above
- '@osedea/eslint-config/flow'
- '@osedea/eslint-config/prettier' # always needs to be lastextends:
- '@osedea/eslint-config/node' # extends other configs, see aboveextends:
- '@osedea/eslint-config/es5'
- '@osedea/eslint-config/angular'
# You can override rules from the linter here. Use at your own risk.
# rules:
# comma-dangle: off # For example, if you do not want the linter to check for dangling commas everGlobal settings
Depending on your config, you may need to add a settings block to your .eslintrc.yml.
osedea/typescript
Add this block to your eslintrc:
parserOptions:
project: './tsconfig.json'If using VSCode & eslint errors aren't displaying, add this to your settings.json:
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],osedea/react-native
For react-native config, in order to resolve imports (import x from CoolProject/.../...), the project name must be defined. The plugin will use the name param of the package.json in order to solve this.
{
"name": "CoolProject",
...
}osedea/node
For node config, it uses the engines section of package.json:
{
...
engines: {
"node": ">= 6.0.0"
},
...
}osedea/prettier
Needs to be added last so it is able to override other configs.
osedea/import
If you're using webpack to alias your directories, you can fix this by installing eslint-import-resolver-webpack and adding to your project's eslintrc:
settings:
import/resolver: webpackosedea/flow
Use a flow plugin for your editor (for example, flow language support for VSCode). Otherwise using eslint-plugin-flowtype-errors is an option.