Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
fce5e8dc3a | ||
|
3486d0d6c0 | ||
|
40817389a1 | ||
|
79da8986db | ||
|
1c4260a937 | ||
|
afc680cb29 | ||
|
7c769fee49 |
@@ -6,8 +6,9 @@
|
|||||||
- Auto fix for formatting (aimed to be used standalone without Prettier)
|
- Auto fix for formatting (aimed to be used standalone without Prettier)
|
||||||
- Designed to work with TypeScript, Vue out-of-box
|
- Designed to work with TypeScript, Vue out-of-box
|
||||||
- Lint also for json, yaml, markdown
|
- Lint also for json, yaml, markdown
|
||||||
- Sorted imports, dangling commas for cleaner commit diff
|
- Sorted imports, dangling commas
|
||||||
- Reasonable defaults, best practices, only one-line of config
|
- Reasonable defaults, best practices, only one-line of config
|
||||||
|
- **Style principle**: Minimal for reading, stable for diff
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@@ -54,6 +55,10 @@ Install [VS Code ESLint extension](https://marketplace.visualstudio.com/items?it
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### TypeScript Aware Rules
|
||||||
|
|
||||||
|
Type aware rules are enabled when a `tsconfig.eslint.json` is found in the project root. Refer to [this file](https://github.com/antfu/eslint-config/blob/main/packages/typescript/index.js#L17).
|
||||||
|
|
||||||
## Extended Reading
|
## Extended Reading
|
||||||
|
|
||||||
Learn more about the context - [Why I don't use Prettier](https://antfu.me/posts/why-not-prettier).
|
Learn more about the context - [Why I don't use Prettier](https://antfu.me/posts/why-not-prettier).
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@antfu/eslint-config-monorepo",
|
"name": "@antfu/eslint-config-monorepo",
|
||||||
"version": "0.31.1",
|
"version": "0.33.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"packageManager": "pnpm@7.1.0",
|
"packageManager": "pnpm@7.1.0",
|
||||||
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@antfu/eslint-config",
|
"name": "@antfu/eslint-config",
|
||||||
"version": "0.31.1",
|
"version": "0.33.1",
|
||||||
"description": "Anthony's ESLint config",
|
"description": "Anthony's ESLint config",
|
||||||
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@antfu/eslint-config-basic",
|
"name": "@antfu/eslint-config-basic",
|
||||||
"version": "0.31.1",
|
"version": "0.33.1",
|
||||||
"description": "",
|
"description": "",
|
||||||
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "eslint-plugin-antfu",
|
"name": "eslint-plugin-antfu",
|
||||||
"version": "0.31.1",
|
"version": "0.33.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"homepage": "https://github.com/antfu/eslint-config",
|
"homepage": "https://github.com/antfu/eslint-config",
|
||||||
"main": "./dist/index.cjs",
|
"main": "./dist/index.cjs",
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@antfu/eslint-config-react",
|
"name": "@antfu/eslint-config-react",
|
||||||
"version": "0.31.1",
|
"version": "0.33.1",
|
||||||
"description": "",
|
"description": "",
|
||||||
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
const fs = require('fs')
|
||||||
|
const { join } = require('path')
|
||||||
const basic = require('@antfu/eslint-config-basic')
|
const basic = require('@antfu/eslint-config-basic')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@@ -11,7 +13,30 @@ module.exports = {
|
|||||||
node: { extensions: ['.js', '.jsx', '.mjs', '.ts', '.tsx', '.d.ts'] },
|
node: { extensions: ['.js', '.jsx', '.mjs', '.ts', '.tsx', '.d.ts'] },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
overrides: basic.overrides,
|
overrides: basic.overrides.concat(
|
||||||
|
!fs.existsSync(join(process.cwd(), 'tsconfig.eslint.json'))
|
||||||
|
? []
|
||||||
|
: [{
|
||||||
|
parserOptions: {
|
||||||
|
tsconfigRootDir: process.cwd(),
|
||||||
|
project: ['tsconfig.eslint.json'],
|
||||||
|
},
|
||||||
|
parser: '@typescript-eslint/parser',
|
||||||
|
excludedFiles: ['**/*.md/*.*'],
|
||||||
|
files: ['*.ts', '*.tsx', '*.mts', '*.cts'],
|
||||||
|
rules: {
|
||||||
|
'no-throw-literal': 'off',
|
||||||
|
'@typescript-eslint/no-throw-literal': 'error',
|
||||||
|
'no-implied-eval': 'off',
|
||||||
|
'@typescript-eslint/no-implied-eval': 'error',
|
||||||
|
'dot-notation': 'off',
|
||||||
|
'@typescript-eslint/dot-notation': ['error', { allowKeywords: true }],
|
||||||
|
'no-void': ['error', { allowAsStatement: true }],
|
||||||
|
'@typescript-eslint/no-floating-promises': 'error',
|
||||||
|
'@typescript-eslint/no-misused-promises': 'error',
|
||||||
|
},
|
||||||
|
}],
|
||||||
|
),
|
||||||
rules: {
|
rules: {
|
||||||
'import/named': 'off',
|
'import/named': 'off',
|
||||||
|
|
||||||
@@ -109,17 +134,6 @@ module.exports = {
|
|||||||
// antfu
|
// antfu
|
||||||
'antfu/generic-spacing': 'error',
|
'antfu/generic-spacing': 'error',
|
||||||
|
|
||||||
// The following rule overrides require a parser service, aka. require a `typescript.json` path.
|
|
||||||
// This needs to be done individually for each project, and it slows down linting significantly.
|
|
||||||
// 'no-throw-literal': 'off',
|
|
||||||
// '@typescript-eslint/no-throw-literal': 'error',
|
|
||||||
// 'no-implied-eval': 'off',
|
|
||||||
// '@typescript-eslint/no-implied-eval': 'error',
|
|
||||||
// 'dot-notation': 'off',
|
|
||||||
// '@typescript-eslint/dot-notation': ['error', { allowKeywords: true }],
|
|
||||||
// '@typescript-eslint/no-floating-promises': 'error',
|
|
||||||
// '@typescript-eslint/no-misused-promises': 'error',
|
|
||||||
|
|
||||||
// off
|
// off
|
||||||
'@typescript-eslint/consistent-indexed-object-style': 'off',
|
'@typescript-eslint/consistent-indexed-object-style': 'off',
|
||||||
'@typescript-eslint/naming-convention': 'off',
|
'@typescript-eslint/naming-convention': 'off',
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@antfu/eslint-config-ts",
|
"name": "@antfu/eslint-config-ts",
|
||||||
"version": "0.31.1",
|
"version": "0.33.1",
|
||||||
"description": "",
|
"description": "",
|
||||||
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@antfu/eslint-config-vue",
|
"name": "@antfu/eslint-config-vue",
|
||||||
"version": "0.31.1",
|
"version": "0.33.1",
|
||||||
"description": "",
|
"description": "",
|
||||||
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
Reference in New Issue
Block a user