eslint-config-gmapitesting
v1.0.4
Published
reusable eslint config for node tests targeting apis
Downloads
11
Readme
eslint-config-gmapitesting
Set of eslint and prettier settings for my own use.
How to set up:
- Install peer dependencies
npx install-peerdeps --dev eslint-config-gmapitesting
- Install the package
npm install eslint-config-gmapitesting
- In the root of the project create a
.eslintrc.json
file that contains:
{
"extends": [
"eslint-config-gmapitesting"
]
}
- Add further rules or override existing behavior in
.eslint.json
if needed:
{
"extends": [
"eslint-config-gmapitesting"
],
"rules": {
"no-console": "error",
"prettier/prettier": [
"error",
{
"trailingComma": "es5",
"singleQuote": true,
"printWidth": 120,
"tabWidth": 8,
}
]
}
}
How to run linting with npm:
Include in package.json
:
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix"
},
How to use with vscode:
These settings will turn on format on save and override existing configurations for eslint and prettier extensions.
Install eslint and prettier extensions if not already installed.
Apply settings to individual workspaces and leave defaults untouched.
- Open seettings with
ctrl+,
- Select Workspace and open the settings JSON
- Paste the following settings:
// turn on format on save
"editor.formatOnSave": true,
// but turn it off for js files as this will be done by eslint
"[javascript]": {
"editor.formatOnSave": false
}
// tell the ESLint plugin to run on save
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
// Turn off prettier extension formatting as settings are already applied to filetype through eslint
"prettier.disableLanguages": ["javascript"]