Shared ESLint config based on semistandard.
Install via npm cli
npm i -D git+ssh://[email protected]:UnumID/eslint-config.git#{version}
Or by adding to package.json
directly
{
...
"devDependencies": {
...
"@unumid/eslint-config": "git+ssh://[email protected]:UnumID/eslint-config.git#{version}"
}
}
The eslint
package itself and required ESLint plugins are peer dependencies, and must be installed separately in projects that use this one.
npm i -D eslint eslint-plugin-import eslint-plugin-jest eslint-plugin-node eslint-plugin-promise
Simply extend @unumid/eslint-config
in the project's ESLint config (.eslintrc
, .eslintrc.js
, etc)
{
"extends": ["@unumid/eslint-config"]
}
import/extensions
: Don't require file extensions when importing.js
or.ts
files.no-unused-vars
: Allow unused variables only if they are prefixed with an underscore (_
), to accommodate frameworks like Feathers that sometimes have strict requirements for function/method types, but not implementations, while making it clear when a variable isn't used.no-useless-constructor
: Disabled to allow use of constructor shorthand, e.g.constructor(private readonly app: Application) {}
indent
/@typescript-eslint/indent
andno-use-before-define
/@typescript-eslint/no-use-before-define
: These rules have some conflicts between the base eslint versions and the typescript versions, so we've done our best to make them work for us.space-before-function-paren
: This rule is turned off because Prettier doesn't support it, and it's not very important.