@megahertz/eslint-config
v1.0.2
Published
Mix of Airbnb, Typescript, Unicorn Prettier and other ESLint rules
Downloads
322
Readme
@megahertz/eslint-config
Mix of Airbnb, Typescript, Unicorn Prettier and other ESLint rules
ESLint
The ESLint configuration is based on eslint-config-airbnb-extended, which modernizes and replaces parts of eslint-config-airbnb and eslint-config-airbnb-typescript.
A typical project config that reuses these shared configs looks like this:
import { configs, defineConfig } from '@megahertz/eslint-config';
export default defineConfig(
configs.base,
configs.ts,
configs.prettier,
configs.react,
configs.nodeCommonJs,
{
rules: {
'no-console': 'off',
},
},
);Predefined configs from this package are applied first, then any project-specific rules are merged on top.
See src/index.js in this package for a list of available configs and short
descriptions.
Some configs come in multiple strictness levels. When you choose a strict variant, also include the base config, since it's not inherited.
| Base | Strict | Description |
| ------------ | ----------- | ------------------------------------------------------------------- |
| base | strict | JavaScript rules |
| ts | tsStrict | TypeScript rules |
| react | reactStrict | React-specific rules |
| prettier | - | Loads Prettier-related rule adjustments |
| sort | - | Sort code elements alphabetically |
| node | - | Best practices for Node.js |
| browser | - | Just enable browser globals |
| nodeCommonJs | - | For CommonJS .js/.cjs files (configs, scripts, not source code) |
| esm | - | ESM-specific rules |
| unicorn | - | Rules from eslint-plugin-unicorn |
Prettier
you can reuse the config by placing prettier.config.mjs in your project root:
export { default } from '@megahertz/eslint-config/prettier.config.js';tsconfig
A shared TypeScript base config is available. To reuse it, extend it from your
package's tsconfig.json:
{
"extends": "@megahertz/eslint-config/tsconfig.base.json",
"include": ["src/**/*.ts"]
}