2.0.0 • Published 6 months ago
@mizdra/eslint-config-mizdra v2.0.0
eslint-config-mizdra
ESLint config for @mizdra
Install
npm i -D @mizdra/eslint-config-mizdra eslint
Usage
With legacy config
module.exports = {
root: true,
extends: ['@mizdra/mizdra', '@mizdra/mizdra/+react', '@mizdra/mizdra/+prettier'],
parserOptions: { ecmaVersion: 2021 },
env: { es2021: true, node: true, browser: true, jest: true },
rules: {
// Write your favorite rules
},
overrides: [
// For TypeScript
{
files: ['*.ts', '*.tsx', '*.cts', '*.mts'],
extends: ['@mizdra/mizdra/+typescript', '@mizdra/mizdra/+prettier'],
rules: {
// Write your favorite rules for TypeScript
},
},
],
};
With flat config
// @ts-check
import { FlatCompat } from '@eslint/eslintrc';
import js from '@eslint/js';
import globals from 'globals';
const __dirname = new URL('.', import.meta.url).pathname;
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});
/** @type {import('eslint').Linter.FlatConfig[]} */
export default [
{ ignores: ['**/dist'] },
...compat.extends('@mizdra/mizdra', '@mizdra/mizdra/+react'),
{
languageOptions: {
ecmaVersion: 2021,
globals: { ...globals.node, ...globals.browser, ...globals.jest },
},
rules: {
// Write your favorite rules
},
},
...compat.config({
overrides: [
{
// For TypeScript
files: ['*.ts', '*.tsx', '*.cts', '*.mts'],
extends: ['../src/+typescript.js'],
rules: {
// Write your favorite rules for TypeScript
},
},
],
}),
...compat.extends('@mizdra/mizdra/+prettier'),
];
Built-in 3rd-party packages
When eslint-config-mizdra
is installed the following packages are installed as its dependencies
for usability. The installed version is always the latest.
@typescript-eslint/eslint-plugin
@typescript-eslint/parser
eslint-config-prettier
eslint-plugin-import
eslint-plugin-react
eslint-plugin-react-hooks
FAQ
How can we upgrade built-in 3rd-party packages?
Uninstall eslint-config-mizdra
and then reinstall it. It will then switch to the latest built-in 3rd-party packages.
npm un @mizdra/eslint-config-mizdra
npm i -D @mizdra/eslint-config-mizdra
How do we pin built-in 3rd-party packages to a specific version?
Use the overrides
field for npm and pnpm, or the resolutions
field for yarn.
// package.json
{
"overrides": {
"@typescript-eslint/parser": "^4.0.0"
}
}
In npm and pnpm, you can also match the version written in dependencies
.
// package.json
{
"dependencies": {
"@typescript-eslint/parser": "^4.0.0"
},
"overrides": {
"@typescript-eslint/parser": "$@typescript-eslint/parser"
}
}
2.1.0-alpha.0
6 months ago
2.0.0-beta.2
1 year ago
2.0.0
1 year ago
2.0.0-beta.3
1 year ago
2.0.0-beta.1
1 year ago
2.0.0-beta.0
1 year ago
1.2.0
2 years ago
1.1.0
2 years ago
1.0.0
3 years ago
0.9.0
3 years ago
0.8.0
3 years ago
0.7.0
3 years ago
0.6.0
3 years ago
0.5.0
4 years ago
0.4.0
4 years ago
0.3.0
4 years ago
0.2.2
4 years ago
0.2.1
4 years ago
0.1.1
4 years ago