
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
eslint-config-auto
Advanced tools
Automatically configure ESLint based on project dependencies
This config will automatically configure the airbnb esLint rules and a range of other plugins, based on the contents of your projects package.json
file.
To install this config, run the following command.
npm install eslint-config-auto --save-dev
Create an .eslintrc
file with the following contents.
{
"extends": ["auto"]
}
You can now include html
, json
and markdown
in the list of files passed to eslint
to lint any JavaScript contained.
{
"scripts": {
"eslint": "eslint --color --ext .html,.js,.json,.jsx,.md,.ts,.tsx *.* src",
"eslint:fix": "npm run eslint -- --fix"
}
}
After you have configured eslint
to include this package, the first time you run eslint
it will output the npm
command to install the dependencies required for your project. Copy and paste this command into the console, and you are then ready to start linting.
The most appropreate version of the AirBNB eslint config will be automatically selected.
If the project includes Babel in it's devDependcies
, then eslint-plugin-babel and eslint-config-airbnb-babel will be loaded and the parser will be set to babel-eslint
.
Some project setup utils, such as Create React App, use Babel without including it as a project dependancies. In such cases you can turn Babel support on by adding settings: { babel: true }
to your .eslintrc
config file.
These two plugins provide a range of code quality rules:
If settings.compat = true
in your .eslintrc
, then eslint-plugin-compat is loaded.
The following plugins expand esLint to support TypeScript, JSON, and lint code contiained in HTML and MarkDown files:
If the project includes TypeScript, then the rules will adapt to lint typescript files and the parser will be set to @typescript-eslint/parser
for ts
and tsx
filetypes.
When linting code snippets in Markdown files, a few rules relating to globals and unused vars are disabled.
These plugins will be loaded in based on your project dependencies
in package.json
. If a supported library is part of your project then it's related esLint plugins will be loaded. The following packages are supported:
If env.node = true
in your .eslintrc
file, then eslint-plugin-node is loaded.
If a project contians React, then a React version of the AirBNB config will be used and if Redux is installed the following extra plugins will be loaded.
The following esLint plugins enforce good coding practices:
If prettier is installed, any rules that may conflict with Prettier will be disabled. The plugin should read you Prettier config from your project's root.
The prettier configs for different eslint plugins are also automatically included based on which eslint plugins have been installed into your project.
These plugins add code security rules to esLint:
Test plugins are loaded based on which testing tools you have listed in devDependencies
of package.json
. The following test plugins are supported:
For test files a few rules are turned off, to better to support normal unit test coding styles.
In the most part the default rules are used for the plugins listed above, with the following exceptions.
Adds the fallthrough: 'never'
option to the newline-between-switch-case
rule.
// Good
switch (foo) {
case 1:
something()
break
case 2:
case 3:
somethingElse()
break
default:
defaultThing()
}
The following rules are disabled due to them being considered unduly restrictive or unhelpful.
The following rules are disabled due to clashing with other plugins
Copyright © 2020 David J. Bradshaw. Licensed under the MIT License.
FAQs
Automatically configure esLint based on project dependancies
The npm package eslint-config-auto receives a total of 2,037 weekly downloads. As such, eslint-config-auto popularity was classified as popular.
We found that eslint-config-auto demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.