eslint-config-dia
ESLint > shareable config for most sort of projects at DIA
Table of Contents
Installation
npm install --save-dev @interaktiv/eslint-config-dia
Usage
Once the @interaktiv/eslint-config-dia
package is installed, you can use it by
specifying @interaktiv/dia
in the extends
section of your
ESLint configuration.
{
"extends": "@interaktiv/dia",
"rules": {
// Additional, per-project rules...
}
}
Notes
Please note that most of the stylistic rules are disabled cause we are using Prettier to format our code. Therefore the eslint-config-prettier plugin is included.
Our Prettier shareable config can be found here @interaktiv/prettier-config-dia.
Provided configurations
The default config actually is composed of several configurations and you can use those individually. These are the configs it's using:
You can use each of these configs yourself. Also, the es6
, import
,
promise
, security
configs each have a possible-errors.js
,
best-practices.js
(and stylistic.js
) which they are composed of as well.
But not only these, others too, checkout out the source.
Optional configurations
Other configs are exposed also. You can use them standalone:
{
"extends": "@interaktiv/dia/<config-name>"
}
or in combination with the base config (recommended):
{
"extends": [
"@interaktiv/dia",
"@interaktiv/dia/<config-name>"
]
}
for example
{
"extends": [
"@interaktiv/dia",
"@interaktiv/dia/titanium",
"@interaktiv/dia/jest",
]
}
-
aura - Salesforce Lightning Aura Components
-
babel - Babel JavaScript compiler for next generation JavaScript
-
jsx-a11y - Rules regarding accessibility with JSX
-
lwc - Salesforce Lightning Web Components
- lwc/compat-performance - Older browsers like IE11 run LWC in compatibility mode. For more information about browser performance, please refer to Supported Browsers in the Lightning Web Components Developer Guide.
-
salesforce - A merge of the
lwc
andaura
configs to support Javascript Development on the Salesforce Platform. Where theaura
config is only applied to**/aura/**/*.js
and thelwc
config to**/lwc/**/*.js
files.If you need to apply the
aura
orlwc
configs to all files e.g. in a sub dir eslint config file, just extend from them not from thesalesforce
config.{ "extends": [ "@interaktiv/dia/aura", "@interaktiv/dia/lwc" ] }
-
titanium - A merge of the
classic
andalloy
configs-
titanium/alloy - Copied and extended from
eslint-config-axway Env Alloy, the
titanium
config is merged into this one - titanium/classic - Copied and extended from eslint-config-axway Env Titanium
-
titanium/alloy - Copied and extended from
eslint-config-axway Env Alloy, the
-
react-native - Combination of the react config and some React Native specific rules
-
webpack - For the import plugin to work with webpack overloaded imports/requires (eslint-plugin-import and eslint-import-resolver-webpack)
Things to know
-
All plugins needed for rules used by these configs are dependencies of this module so you don't have to install anything on your own.
-
Almost all of the stylistic rules are disabled cause we are using prettier to format our code. To ensure this the eslint-config-prettier is included too.
Our Prettier shareable config can be found here @interaktiv/prettier-config-dia.
-
The lwc and aura configs disable some import config rules cause there is no lwc module resolver package available at the moment of time.
ESLint Dependencies
- eslint-config-prettier
- eslint-import-resolver-webpack
- eslint-plugin-alloy
- eslint-plugin-aura
- eslint-plugin-babel
- eslint-plugin-compat
- eslint-plugin-eslint-comments
- eslint-plugin-import
- eslint-plugin-jest
- eslint-plugin-json
- eslint-plugin-jsx-a11y
- eslint-plugin-lwc
- eslint-plugin-promise
- eslint-plugin-react
- eslint-plugin-react-hooks
- eslint-plugin-react-native
- eslint-plugin-security
Example Implementations
Salesforce Platform Development with LWC and Aura
{
extends: [
'@interaktiv/dia',
'@interaktiv/dia/jest',
'@interaktiv/dia/salesforce'
],
// Custom rules if needed
rules: {}
}
Node.js Package / App with Jest
{
extends: [
'@interaktiv/dia',
'@interaktiv/dia/jest'
],
// Custom rules if needed
rules: {}
}
Appcelerator Titanium Mobile App
{
extends: [
'@interaktiv/dia',
'@interaktiv/dia/titanium'
],
// Custom rules if needed
rules: {}
}
License
MIT Copyright © 2019-present die.interaktiven GmbH & Co. KG