Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chuhoman/eslint-config
ChuHoMan's ESLint config preset
https://github.com/chuhoman/eslint-config
eslint eslint-config
Last synced: 11 days ago
JSON representation
ChuHoMan's ESLint config preset
- Host: GitHub
- URL: https://github.com/chuhoman/eslint-config
- Owner: ChuHoMan
- License: mit
- Created: 2022-05-03T07:04:01.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-19T08:06:30.000Z (12 months ago)
- Last Synced: 2024-10-27T07:04:43.669Z (12 days ago)
- Topics: eslint, eslint-config
- Language: TypeScript
- Homepage:
- Size: 202 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @chuhoman/eslint-config
[![npm](https://img.shields.io/npm/v/@chuhoman/eslint-config?color=91B2D4&label=)](https://npmjs.com/package/@chuhoman/eslint-config)
English | įŽäŊä¸æ> [!IMPORTANT]
> Since v1.0.0, this config is rewritten to the new [ESLint Flat config](https://eslint.org/docs/latest/use/configure/configuration-files-new).## Usage
### Install
```bash
# pnpm
pnpm install -D eslint @chuhoman/eslint-config
```### Create config file
With [`"type": "module"`](https://nodejs.org/api/packages.html#type) in `package.json` (recommended):
```js
// eslint.config.js
import chuhoman from '@chuhoman/eslint-config';export default chuhoman();
```With CJS:
```js
// eslint.config.js
const chuhoman = require('@chuhoman/eslint-config').default;module.exports = chuhoman();
```### Add script for package.json
For example:
```json
{
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix"
}
}
```### Config VS Code
Install [VS Code ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and create `.vscode/settings.json`
```json
{
"prettier.enable": false,
// Enable the ESlint flat config support
"eslint.experimental.useFlatConfig": true,// Disable the default formatter, use eslint instead
"editor.formatOnSave": false,// Auto fix
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.organizeImports": false
},// Silent the stylistic rules in you IDE, but still auto fix them
"eslint.rules.customizations": [
{ "rule": "style/*", "severity": "off" },
{ "rule": "*-indent", "severity": "off" },
{ "rule": "*-spacing", "severity": "off" },
{ "rule": "*-spaces", "severity": "off" },
{ "rule": "*-order", "severity": "off" },
{ "rule": "*-dangle", "severity": "off" },
{ "rule": "*-newline", "severity": "off" },
{ "rule": "*quotes", "severity": "off" },
{ "rule": "*semi", "severity": "off" }
],// Enable eslint for all supported languages
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"html",
"markdown",
"json",
"jsonc",
"yaml"
]
}
```### Customization
you can configure each integration individually, for example:
```js
// eslint.config.js
import chuhoman from '@chuhoman/eslint-config';export default chuhoman(
{
// Enable stylistic formatting rules
// stylistic: true,// Or customize the stylistic rules
stylistic: {
indent: 2, // 4, or 'tab'
quotes: 'single', // or 'double'
},// TypeScript and Vue are auto-detected, you can also explicitly enable them:
typescript: true,
vue: true,// Disable jsonc and yaml support
jsonc: false,
yaml: false,// `.eslintignore` is no longer supported in Flat config, use `ignores` instead
ignores: [
'./fixtures',
// ...globs
]
},
// From the second arguments they are ESLint Flat Configs
// you can have multiple configs
{
files: ['**/*.ts'],
rules: {},
},
{
rules: {},
},
);
```## Credits
Inspired by
- [@antfu/eslint-config](https://github.com/antfu/eslint-config)
## License
Made with đ
Published under [MIT License](./LICENSE).