Gathering detailed insights and metrics for @anolilab/eslint-config
Gathering detailed insights and metrics for @anolilab/eslint-config
Gathering detailed insights and metrics for @anolilab/eslint-config
Gathering detailed insights and metrics for @anolilab/eslint-config
npm install @anolilab/eslint-config
Typescript
Module System
Min. Node Version
Node Version
NPM Version
@anolilab/stylelint-config@6.0.14
Updated on Dec 22, 2023
browserslist-config-anolilab@5.0.14
Updated on Dec 22, 2023
@anolilab/prettier-config@5.0.14
Updated on Dec 22, 2023
@anolilab/lint-staged-config@2.1.7
Updated on Dec 22, 2023
@anolilab/eslint-config@15.0.3
Updated on Dec 22, 2023
@anolilab/commitlint-config@5.0.3
Updated on Dec 22, 2023
TypeScript (97.74%)
JavaScript (1.5%)
Shell (0.74%)
CSS (0.02%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
85,687
Last Day
136
Last Week
423
Last Month
2,972
Last Year
29,936
MIT License
9 Stars
2,302 Commits
3 Forks
3 Watchers
12 Branches
4 Contributors
Updated on Jan 12, 2025
Minified
Minified + Gzipped
Latest Version
15.0.3
Package Id
@anolilab/eslint-config@15.0.3
Unpacked Size
560.86 kB
Size
119.37 kB
File Count
221
NPM Version
9.6.7
Node Version
20.6.1
Published on
Dec 22, 2023
Cumulative downloads
Total Downloads
Last Day
325%
136
Compared to previous day
Last Week
-42.2%
423
Compared to previous week
Last Month
4.8%
2,972
Compared to previous month
Last Year
-28.9%
29,936
Compared to previous year
45
29
42
Daniel Bannert's open source work is supported by the community on GitHub Sponsors
Our package serves as a valuable resource for JavaScript/Typescript-based projects, offering composable ESLint configurations. It encompasses a range of features, including performance optimization and the flexibility to extend pre-defined base configurations.
Tailored Configuration for Workspaces: With this package, each workspace within your monorepo gains the ability to have its own customized ESLint configuration. This ensures that individual projects can maintain their specific requirements while still adhering to the overall guidelines.
Configurability at Your Fingertips: Crafting your workspace's ESLint configuration is a breeze, thanks to the seamless composition of pre-defined base configurations. This empowers you to tailor the settings to suit your project's unique needs, without starting from scratch.
Streamlined Convenience: Say goodbye to the hassle of installing plugins for each workspace. Our package integrates @rushstack/eslint-patch, eliminating the need for repetitive plugin installations. Enjoy peace of mind as you focus on your work, knowing that the necessary plugins are automatically included.
Enhanced Efficiency: We've optimized the package's performance by intelligently enabling plugins based on file naming conventions. This streamlined approach ensures that your ESLint checks run efficiently, targeting the relevant files and maximizing productivity.
In summary, our package provides comprehensive and adaptable ESLint configurations for JavaScript and Typescript projects. It empowers you to achieve code quality while minimizing overhead and maximizing productivity throughout your workspaces.
typescript
was installed.To install this config, run the following command.
Note:
eslint-plugin-import@npm:eslint-plugin-i
is needed to use the correct package.
1npm install --save-dev eslint @anolilab/eslint-config eslint-plugin-import@npm:eslint-plugin-i@latest @babel/core @eslint-types/import @eslint-types/deprecation @eslint-types/jsdoc @eslint-types/typescript-eslint @eslint-types/unicorn
1pnpm add -D eslint @anolilab/eslint-config eslint-plugin-import@npm:eslint-plugin-i@latest @babel/core @eslint-types/import @eslint-types/deprecation @eslint-types/jsdoc @eslint-types/typescript-eslint @eslint-types/unicorn
1yarn add -D eslint @anolilab/eslint-config eslint-plugin-import@npm:eslint-plugin-i@latest @babel/core @eslint-types/import @eslint-types/deprecation @eslint-types/jsdoc @eslint-types/typescript-eslint @eslint-types/unicorn
If you don’t have a .eslintrc.js
, we will create the file for you after installing @anolilab/eslint-config
.
If you already have a .eslintrc.js
, then you can extend the .eslintrc.js
, with @anolilab/eslint-config
.
Note: If the script detects an existing
.eslintrc.js
file, it will not overwrite it.
Note: It can happen that the postinstall script don't run, then you have to add the
.eslintrc.js
manually, or you will use bin command./node_modules/bin/anolilab-eslint-config
to generate it.
Note: Our default export contains all of our ESLint rules, including ECMAScript 6+.
@anolilab/eslint-config
use theecmaVersion
:2021
as default.To change this configuration, change
env: { es2021: false, then active you needed env }
same for,parserOptions: { "ecmaVersion": 2021 change the version }
1/** @ts-check */ 2const { defineConfig } = require('@anolilab/eslint-config/define-config'); 3 4/// <reference types="@eslint-types/unicorn" /> 5/// <reference types="@eslint-types/typescript-eslint" /> 6/// <reference types="@eslint-types/jsdoc" /> 7/// <reference types="@eslint-types/import" /> 8/// <reference types="@eslint-types/deprecation" /> 9 10module.exports = defineConfig({ 11 env: { 12 // Your environments (which contains several predefined global variables) 13 // 14 // browser: true, 15 // node: true, 16 // mocha: true, 17 // jest: true, 18 // jquery: true 19 }, 20 extends: ["@anolilab/eslint-config"], 21 globals: { 22 // Your global variables (setting to false means it's not allowed to be reassigned) 23 // 24 // myGlobal: false 25 }, 26 root: true, 27 rules: { 28 // Customize your rules 29 }, 30});
For more advanced use cases see the example configurations for Node, TypeScript, React or Prettier.
Note:
@anolilab/eslint-config
will handle the configuration for almost all eslint-plugins / eslint-configs automatically. With this you only need to install the needed plugins/configs for TypeScript or React and you done.
1npm install --save-dev typescript
Please extend the .eslintrc.js
file with the correct tsconfig.js
path if you have a custom path.
1module.exports = { 2 parserOptions: { 3 project: "./tsconfig.eslint.json", 4 }, 5};
For projects that use TypeScript and want additional rules that require type information (rules using type information take longer to run).
Extend the .eslintrc.js
file:
1/** @ts-check */ 2const { defineConfig } = require('@anolilab/eslint-config/define-config'); 3 4/// <reference types="@eslint-types/unicorn" /> 5/// <reference types="@eslint-types/typescript-eslint" /> 6/// <reference types="@eslint-types/jsdoc" /> 7/// <reference types="@eslint-types/import" /> 8/// <reference types="@eslint-types/deprecation" /> 9 10module.exports = defineConfig({ 11 env: { 12 // Your environments (which contains several predefined global variables) 13 // 14 // browser: true, 15 // node: true, 16 // mocha: true, 17 // jest: true, 18 // jquery: true 19 }, 20 extends: ["@anolilab/eslint-config", "@anolilab/eslint-config/typescript-type-checking"], 21 globals: { 22 // Your global variables (setting to false means it's not allowed to be reassigned) 23 // 24 // myGlobal: false 25 }, 26 root: true, 27 rules: { 28 // Customize your rules 29 }, 30});
Tip: Run eslint with the TIMING=1 to identify slow rules.
TIMING=1 eslint . --ext .ts,.tsx
This is useful to identify rules that are slow because they require type information.
You need to have "react" and "react-dom" installed.
1npm install --save-dev eslint-plugin-react eslint-plugin-react-hooks 2 3yarn add -D eslint-plugin-react eslint-plugin-react-hooks 4 5pnpm add -D eslint-plugin-react eslint-plugin-react-hooks
Or for the use of TypeScript
in react install "typescript" as a dev dependency.
Please extend the .eslintrc.js
file with the correct tsconfig.js
path if you have a custom path.
1module.exports = { 2 parserOptions: { 3 project: "./tsconfig.eslint.json", 4 }, 5};
Or for the use of .jsx
files install "@babel/plugin-syntax-jsx" as a dev dependency.
1npm install --save-dev babel @babel/plugin-syntax-jsx 2 3yarn add -D babel @babel/plugin-syntax-jsx 4 5pnpm add -D babel @babel/plugin-syntax-jsx
In your babel.config.js
file add the plugin.
1const babelPluginSyntaxJSX = require("@babel/plugin-syntax-jsx"); 2 3module.exports = { 4 plugins: [ 5 [ 6 babelPluginSyntaxJSX, 7 { 8 pragma: "React.createElement", 9 pragmaFrag: "React.Fragment", 10 }, 11 ], 12 ], 13};
1npm install --save-dev eslint eslint-plugin-mdx
For more information about missing
or optional
to install rules see the eslint
console output.
You can configure @anolilab/eslint-config
options with your package.json
file.
Add this property to your package.json:
1{ 2 anolilab: { 3 "eslint-config": { 4 // options 5 }, 6 }, 7}
Type: number
Default: 4
It will throw an error if the value is not numeric.
Type: object
-> key: string
value: boolean
Disable a plugin in your package.json config to turn it off globally in your project.
Example using package.json:
1{ 2 "anolilab": { 3 "eslint-config": { 4 "plugin": { 5 "unicorn": false 6 } 7 } 8 } 9}
Type: boolean
Default: undefined
To disable the warning, set the value to false
.
1{ 2 "anolilab": { 3 "eslint-config": { 4 "warn_on_unsupported_typescript_version": false 5 } 6 } 7}
Type: boolean
Default: undefined
To disable the info, set the value to false
.
1{ 2 "anolilab": { 3 "eslint-config": { 4 "info_on_disabling_jsx_react_rule": false 5 } 6 } 7}
Type: boolean
Default: undefined
To disable the info, set the value to false
.
1{ 2 "anolilab": { 3 "eslint-config": { 4 "info_on_disabling_prettier_conflict_rule": false 5 } 6 } 7}
Type: boolean
Default: undefined
To disable the info, set the value to false
.
1{ 2 "anolilab": { 3 "eslint-config": { 4 "info_on_disabling_jsonc_sort_keys_rule": false 5 } 6 } 7}
Type: boolean
Default: undefined
To disable the info, set the value to false
.
1{ 2 "anolilab": { 3 "eslint-config": { 4 "info_on_disabling_etc_no_deprecated": false 5 } 6 } 7}
Type: boolean
Default: undefined
To disable the info, set the value to false
.
1{ 2 "anolilab": { 3 "eslint-config": { 4 "info_on_testing_library_framework": false 5 } 6 } 7}
Type: boolean
Default: undefined
To disable the info, set the value to false
.
1{ 2 "anolilab": { 3 "eslint-config": { 4 "info_on_found_react_version": false 5 } 6 } 7}
Type: string[]
Default: []
An array with files/paths for which unused exports will not be reported (e.g module entry points in a published package).
1{ 2 "anolilab": { 3 "eslint-config": { 4 "import_ignore_exports": [] 5 } 6 } 7}
Prettier is a code formatting tool that offers fewer options but is more professional than the style-related rules in ESLint.
Now that Prettier has become a necessary tool in front end projects, @anolilab/eslint-config
does not need to maintain the style-related rules in ESLint anymore,
so we completely removed all Prettier related rules, if prettier
is found in your package.json
and use ESLint to check logical errors which it’s good at.
As for whether two spaces or four spaces are used for indentation and whether there is a semicolon at the end, you can configure it in the project’s .prettierrc.js
.
Of course, we also provide a recommended Prettier configuration for your reference.
@anolilab/eslint-config
does disable all included style-related rules, so there is no need to install eslint-config-prettier
.
If you are using experimental features such as class fields with JavaScript files you should install @babel/eslint-parser
.
1npm install --save-dev @babel/core
This plugin provide a range of code quality rules:
The following plugins expand esLint to work with json files, and lint JavaScript contained in HTML, and MarkDown:
When linting code snippets in Markdown files, a few rules relating to globals and unused vars are disabled.
If a supported library is part of your project then it’s related esLint plugins will be loaded. The following plugins are supported:
eslint-plugin-lodash
and lodash
to use this plugin.eslint-plugin-lodash-fp
and lodash
to use this plugin.eslint-plugin-react-redux
and react-redux
to use this plugin.eslint-plugin-redux-saga
and redux-saga
to use this plugin.The following esLint plugins enforce good coding practices:
These plugins add code security rules to esLint:
The following test plugins are supported:
eslint-plugin-ava
and ava
to use this plugin.eslint-plugin-jest
and jest
to use this plugin.eslint-plugin-jest-async
and jest
to use this plugin.eslint-plugin-cypress
and cypress
to use this plugin.ESLint will not lint .vue
, .ts
or .tsx
files in VSCode by default, you need to set your .vscode/settings.json
like this:
1{ 2 "eslint.validate": ["css", "html", "javascript", "javascriptreact", "json", "markdown", "typescript", "typescriptreact", "yaml"] 3}
If you want to enable auto-fix-on-save, you need to set your .vscode/settings.json
like this:
1{ 2 "editor.codeActionsOnSave": { 3 "source.fixAll.eslint": true 4 }, 5 "editor.defaultFormatter": "dbaeumer.vscode-eslint", 6 "editor.formatOnSave": true 7}
Additionally, we found it that being explicit about which formatter you are using for each file improves DX:
1{ 2 "[css]": { 3 "editor.defaultFormatter": "dbaeumer.vscode-eslint" 4 }, 5 "[html]": { 6 "editor.defaultFormatter": "dbaeumer.vscode-eslint" 7 }, 8 "[javascript]": { 9 "editor.defaultFormatter": "dbaeumer.vscode-eslint" 10 }, 11 "[javascriptreact]": { 12 "editor.defaultFormatter": "dbaeumer.vscode-eslint" 13 }, 14 "[json]": { 15 "editor.defaultFormatter": "dbaeumer.vscode-eslint" 16 }, 17 "[markdown]": { 18 "editor.defaultFormatter": "dbaeumer.vscode-eslint" 19 }, 20 "[typescript]": { 21 "editor.defaultFormatter": "dbaeumer.vscode-eslint" 22 }, 23 "[typescriptreact]": { 24 "editor.defaultFormatter": "dbaeumer.vscode-eslint" 25 }, 26 "[yaml]": { 27 "editor.defaultFormatter": "dbaeumer.vscode-eslint" 28 } 29}
While not required if you've configured explicit formatter for each file type, I advise that you explicitly disable prettier extension in your project:
1{ 2 "prettier.enable": false 3}
Sharing these settings in your project should be sufficient to prevent local settings accidentally overriding the desired formatter behavior.
The standard specification believes that everyone should not waste time in personalized specifications, but the entire community should unify a specification. This statement makes sense, but it runs against the ESLint’s design philosophy. Don’t you remember how ESLint defeated JSHint and became the most popular JS code inspection tool? It’s because of the plugin and configuration that ESLint advocates, which meets the individual needs of different technology stacks of different teams.
Therefore, @anolilab/eslint-config
also inherits the philosophy of ESLint. It will not force you to use our config.
Libraries in this ecosystem make the best effort to track Node.js’ release schedule. Here’s a post on why we think this is important.
If you would like to help take a look at the list of issues and check our Contributing guild.
Note: please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
The anolilab javascript-style-guide is open-sourced software licensed under the MIT license
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
project has 8 contributing companies or organizations
Details
Reason
no dangerous workflow patterns detected
Reason
update tool detected
Details
Reason
license file detected
Details
Reason
30 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
SAST tool detected: CodeQL
Details
Reason
dependency not pinned by hash detected -- score normalized to 8
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Score
Last Scanned on 2025-02-11T07:25:59Z
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More