@jimmy.codes/eslint-config
v3.28.2
Published
another opinionated eslint config
Downloads
1,576
Maintainers
Readme
@jimmy.codes/eslint-config
🔍 another opinionated eslint config
🛠️ Usage
[!NOTE] 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 all you need to in your eslint.config.js
is:
import eslintConfig from "@jimmy.codes/eslint-config";
export default eslintConfig();
Which will enable rules based on your project dependencies.
🔧 Configuration
This package contains rules that can be enabled or disabled as follows:
import eslintConfig from "@jimmy.codes/eslint-config";
export default eslintConfig({
astro: false,
jest: false,
nextjs: false,
playwright: false,
react: false,
storybook: false,
tanstackQuery: false,
testingLibrary: false,
typescript: false,
vitest: false,
});
Or you can turn off auto detection to disable rules based on a project's dependencies:
import eslintConfig from "@jimmy.codes/eslint-config";
export default eslintConfig({ autoDetect: false });
Extending/overriding the Configuration
You can also extend or override the configuration:
import eslintConfig from "@jimmy.codes/eslint-config";
export default eslintConfig({
overrides: [
{
files: ["**/*.js"],
rules: {
"prefer-spread": "error",
},
},
{
files: ["**/*.ts"],
rules: {
"prefer-const": "error",
},
},
],
});
Or pass configs as additional arguments:
import eslintConfig from "@jimmy.codes/eslint-config";
export default eslintConfig(
{},
{
files: ["**/*.js"],
rules: {
"prefer-spread": "error",
},
},
{
files: ["**/*.ts"],
rules: {
"prefer-const": "error",
},
},
);
Ignores
You can also extend what is ignored:
import eslintConfig from "@jimmy.codes/eslint-config";
export default eslintConfig({
ignores: ["**/*.mjs"],
});
TypeScript Configuration Files
If you want to use TypeScript configuration files, you can do the following:
Add --flag unstable_ts_config
to your eslint script, for example:
{
"scripts": {
"lint": "eslint --flag unstable_ts_config ."
}
}
And add the following to your .vscode/settings.json
:
{
"eslint.options": {
"flags": ["unstable_ts_config"]
}
}