1.0.3 • Published 3 years ago
altheajs-eslint-config v1.0.3
altheajs-eslint-config
Althea Web Service's eslint
configuration.
You can view this package on NPM: click here
Installation
npm
npm install --save-dev altheajs-eslint-config
yarn
yarn add --dev altheajs-eslint-config
Usage
Configuration
The simplest way to install and use the default config is to reference it directly in your package.json
file as follows:
{
// ...package.json
"eslintConfig": {
"extends" : "altheajs-eslint-config"
}
}
If you'd like to extend the configurations, create a .eslintrc.js
file at the root of your project that contains:
module.exports = {
"extends": ["altheajs-eslint-config"],
// if using typescript
"parserOptions": { "project": "./tsconfig.json" }
// ...more custom config overrides
};
NPM Scripts Command
You can add in an npm script to your package.json
which will apply lint rules across all the file patterns specified. Simply add the following to apply to all files:
{
// ...package.json
"scripts": {
// check for linting errors
"lint:quality": "npx eslint -c .eslintrc.js . --ext .js,.jsx,.ts,.tsx"
// fix and apply the rules to those that can be fixed
"fix:quality": "npx eslint -c .eslintrc.js . --ext .js,.jsx,.ts,.tsx --fix",
}
}
Editor Integration
Visual Studio Code
- Install ESLint extension:
View → Extensions
then find and install the ESLint extension. - Reload the editor.
In your user settings
Code -> Preferences -> Settings
add the following settings:{ // ...settings.json "editor.codeActionsOnSave": { "source.fixAll.eslint": true } }
Enforced Rules
Check out all of ESlint's configuration options.