Logicer's highly opinionated ESLint configuration as a plugin for use in other projects. Designed to be built upon for the project's specific needs. Dependency plugins may be omitted if they're not configured to be used. For use in flat config files.
Contents:
npm install --save-dev eslint @logicer/eslint-plugin
In your eslint.config.js
:
import {ConfigGenerator} from "@logicer/eslint-plugin";
const generator = new ConfigGenerator({
ecmaVersion: "latest", // or specific version
eslintPlugin: true, // or false (default)
general: true, // (default) or false
jest: true, // or false (default)
jsdoc: true, // or false (default)
prettier: true, // or false (default)
sourceFiles: ["src/**/*"], // The eslint config files value representing the project's source code (default: [])
svelte: true, // or false (default)
tailwind: true, //or false (default)
typescript: true // or false (default)
});
const config = [
...(await generator.config),
// <Your custom config>
...(await generator.endConfig)
];
export default config;
Options are provided to configure sets of similar rules which may conflict with each other or parts of your code.
Extends:
"@eslint/js".configs.recommended
plugin:css/standard
(viaFlatCompat
)plugin:@eslint-community/eslint-comments/recommended
(viaFlatCompat
)"@html-eslint/eslint-plugin".configs["flat/recommended"]
plugin:import-x/recommended
(viaFlatCompat
)"eslint-plugin-json-schema-validator".configs["flat/recommended"]
"eslint-plugin-jsonc".configs["flat/recommended-with-json"]
"eslint-plugin-jsonc".configs["flat/recommended-with-jsonc"]
"eslint-plugin-jsonc".configs["flat/recommended-with-json5"]
"eslint-plugin-markdown".configs.recommended
"eslint-plugin-n".configs["flat/mixed-esm-and-cjs"]
("eslint-plugin-n"configs["flat/recommended"]
for all other files)- A custom rule set of
eslint-plugin-no-constructor-bind
plugin:no-use-extend-native/recommended
(viaFlatCompat
)"eslint-plugin-perfectionist/configs/recommended-natural"
"eslint-plugin-regexp".configs["flat/recommended"]
- A custom rule set of
@microsoft/eslint-plugin-sdl
"eslint-plugin-security".configs.recommended
- A custom rule set of
eslint-plugin-no-constructor-bind
"eslint-plugin-toml".configs["flat/standard"]
- A custom rule set of
@shopify/eslint-plugin
- A custom rule set of
eslint-plugin-simple-import-sort
"eslint-plugin-unicorn".configs["flat/recommended"]
- A custom rule set of
eslint-plugin-unused-imports
"eslint-plugin-yml".configs["flat/standard"]
Enables:
eslint-plugin-html
If prettier
is set, it also extends:
"eslint-plugin-jsonc".configs["flat/prettier"]
"eslint-plugin-yml".configs["flat/prettier"]
Typescript requires extra dependencies:
npm install --save-dev eslint-import-resolver-typescript
Automatically enables general
. Configures @typescript-eslint/parser
and extends:
"typescript-eslint".configs.strictTypeChecked
"typescript-eslint".configs.stylisticTypeChecked
- A custom rule set of
eslint-plugin-array-func
- A custom rule set of
eslint-plugin-decorator-position
plugin:deprecation/recommended
(viaFlatCompat
)plugin:etc/recommended
(viaFlatCompat
)plugin:import-x/typescript
(viaFlatCompat
)- A custom rule set of
eslint-plugin-total-functions
Extends:
"eslint-plugin-eslint-plugin/configs/recommended"
Extends:
"eslint-plugin-jest".configs["flat/snapshots"]
"eslint-plugin-jest".configs["flat/recommended"]
- A custom rule set of
eslint-plugin-jest-extended
- A custom rule set of
eslint-plugin-jest-formatting
Extends:
If typescript
is set:
"eslint-plugin-jsdoc".configs["flat/recommended-typescript-error"]
Otherwise:
"eslint-plugin-jsdoc".configs["flat/recommended-typescript-flavor-error"]
Extends plugin:prettier/recommended
Configures "prettier/prettier"
to use the config from @logicer/prettier-config
. If you need to override any of these options, ensure you do so in both your .prettierrc.js
and the prettier/prettier
rule in your eslint.config.js
.
Extends plugin:tailwindcss/recommended
Extends plugin:svelte/recommended
.
If prettier
is set, it also configures plugin:svelte/prettier
.
This option sets the ecmascript version for eslint and relevant parsers. It expect's ESLint's version format and like ESLint, it defaults to "latest"
.
Additionally, it is used to automatically extend the appropriate configs from eslint-plugin-es-x
.
This plugin comes with some predefined configurations, generated with the following options:
const config = {
general: true,
jsdoc: true
};
const config = {
general: true,
jsdoc: true,
prettier: true
};
const config = {
general: true,
jsdoc: true,
typescript: true
};
Note, Typescript requires extra dependencies: