eslint-config-zl-asica
v1.0.19
Published
A shareable and reusable Eslint configuration by ZL-Asica.
Downloads
1,339
Maintainers
Readme
eslint-config-zl-asica
A shareable and reusable ESLint configuration by ZL Asica, designed to provide consistent linting rules across JavaScript, TypeScript, and React projects with Prettier compatibility. (For Prettier configuration, please check here)
Table of Contents
Installation
Install this package as a development dependency in your project (npm 7+):
npm install --save-dev eslint eslint-config-zl-asica
# or with Yarn
yarn add -D eslint eslint-config-zl-asica
# or with pnpm
pnpm add -D eslint eslint-config-zl-asica
Usage
This configuration offers three modular configurations: default (JavaScript), TypeScript, and React. You can import each as needed.
Basic Usage (JavaScript Projects)
For JavaScript projects, import the base configuration:
// `eslint.config.js` or `eslint.config.mjs`
import { zlAsicaConfig } from 'eslint-config-zl-asica';
export default [
...zlAsicaConfig,
// Custom modifications
{
rules: {
'no-console': 'warn',
},
},
];
TypeScript Projects
For TypeScript projects, use zlAsicaTsConfig
, which includes the base configuration plus TypeScript rules:
// `eslint.config.js` or `eslint.config.mjs`
import { zlAsicaTsConfig } from 'eslint-config-zl-asica';
export default [
...zlAsicaTsConfig,
// Custom modifications
{
rules: {
'no-console': 'warn',
},
},
];
React Projects
For React projects, use zlAsicaReactConfig
, which includes the base configuration plus React rules:
// `eslint.config.js` or `eslint.config.mjs`
import { zlAsicaReactConfig } from 'eslint-config-zl-asica';
export default [
...zlAsicaReactConfig,
// Custom modifications
{
rules: {
'no-console': 'warn',
},
},
];
TypeScript + React Combined
For projects using both TypeScript and React, use zlAsicaTsReactConfig
, a combination of all configurations:
// `eslint.config.js` or `eslint.config.mjs`
import { zlAsicaTsReactConfig } from 'eslint-config-zl-asica';
export default [
...zlAsicaTsReactConfig,
// Custom modifications
{
rules: {
'no-console': 'warn',
},
},
];
Configuration Details
This configuration includes the following rule sets and plugins:
- JavaScript Rules: Consistent formatting and style conventions for JavaScript (and jsx).
- TypeScript Rules: Type-safe coding standards for TypeScript projects.
- React Rules: React-specific rules for React and React hooks.
- Prettier Compatibility: Integrates
eslint-config-prettier
to disable formatting rules that might conflict with Prettier.
Plugins and Settings
import/ignore
: Ignores CSS and other stylesheets for imports.import/order
: External first then internal, newline in between.- React Version Detection: Automatically detects the installed React version.
Why Use This Configuration?
This configuration ensures:
- A consistent code style across multiple projects.
- Easy integration with JavaScript, TypeScript, and React projects.
- Compatibility with Prettier, reducing formatting conflicts.
Contributing
If you’d like to suggest improvements, please feel free to open a pull request or issue on GitHub.
License
This project is licensed under the MIT License.