@jimmy.codes/eslint-config v3.4.2
@jimmy.codes/eslint-config
🔍 another opinionated eslint config
🛠️ Usage
For a better experience, make sure to use @jimmy.codes/prettier-config as well
🔨 Getting Started
First install the package, by running the following:
pnpm add -D @jimmy.codes/eslint-config
Then if you want a simple configuration:
// eslint.config.mjs
import jimmyDotCodes from "@jimmy.codes/eslint-config";
export default jimmyDotCodes();
And if you're using VS Code, make sure to enable flat configuration:
// .vscode/settings.json
{
"eslint.useFlatConfig": true,
}
🔧 Configuration
By default all rules are enabled based on the project's dependencies.
This package contains rules that can be enabled or disabled as follows:
import jimmyDotCodes from "@jimmy.codes/eslint-config";
export default jimmyDotCodes({
/**
* Are TypeScript rules enabled?
* @default false
*/
typescript: true,
/**
* Are React rules enabled?
* @default false
*/
react: true,
/**
* Are Astro rules enabled?
* @default false
*/
astro: true,
/**
* Are testing rules enabled?
* @default false
*/
testing: true,
});
Or you can turn off auto detection to enable rules based on a project's dependencies
import jimmyDotCodes from "@jimmy.codes/eslint-config";
export default jimmyDotCodes({ autoDetect: false });
TypeScript
You can also change the project location which can be helpful for monorepos:
import jimmyDotCodes from "@jimmy.codes/eslint-config";
export default jimmyDotCodes({
typescript: {
project: ["./tsconfig.eslint.json", "./packages/*/tsconfig.json"],
},
});
Testing
By default vitest is used as the testing framework but you can override and add additional rules for utilities:
import jimmyDotCodes from "@jimmy.codes/eslint-config";
export default jimmyDotCodes({
testing: {
framework: "jest",
utilities: ["testing-library"],
},
});
React
You can add additional rules for utilities:
import jimmyDotCodes from "@jimmy.codes/eslint-config";
export default jimmyDotCodes({
react: {
utilities: ["@tanstack/query"],
},
});
Extending the Configuration
You can also extend the configuration:
import jimmyDotCodes from "@jimmy.codes/eslint-config";
export default jimmyDotCodes(
{
configs: [
{
files: ["**/*.js"],
rules: {
"prefer-spread": "error",
},
},
],
},
{
rules: {
"prefer-const": "error",
},
},
);
You can also extend what is ignored:
import jimmyDotCodes from "@jimmy.codes/eslint-config";
export default jimmyDotCodes({
ignores: ["**/*.mjs"],
});
❤️ Credits
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago