@dg-scripts/eslint-config 5.16.0 → 5.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/README.md +67 -0
- package/index.js +47 -25
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,36 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [5.18.0](https://github.com/sabertazimi/bod/compare/v5.17.0...v5.18.0) (2024-04-01)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **eslint-config-bod:** rectify incorrect es6 globals ([#1158](https://github.com/sabertazimi/bod/issues/1158)) ([cd35e76](https://github.com/sabertazimi/bod/commit/cd35e764a9b7d12d43c7e68e5b5ec15e6c171fd4))
|
|
12
|
+
* **eslint-config:** disable tsconfig check for markdown codes ([#1157](https://github.com/sabertazimi/bod/issues/1157)) ([59673e2](https://github.com/sabertazimi/bod/commit/59673e22273067cdb2df744a848e5e5ce36fffc9))
|
|
13
|
+
* **eslint-config:** use glob patterns to match files ([#1154](https://github.com/sabertazimi/bod/issues/1154)) ([1900953](https://github.com/sabertazimi/bod/commit/190095338bfd6a713feee4a4f84efdf177975a07))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
# [5.17.0](https://github.com/sabertazimi/bod/compare/v5.16.0...v5.17.0) (2024-03-30)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* **deps:** update dependency @antfu/eslint-config to ^2.11.6 ([#1139](https://github.com/sabertazimi/bod/issues/1139)) ([623eab5](https://github.com/sabertazimi/bod/commit/623eab59fb89b5e834a189889513a1ce0b0b96c8))
|
|
25
|
+
* **eslint-config:** project config for type-aware rules ([#1138](https://github.com/sabertazimi/bod/issues/1138)) ([b1ab580](https://github.com/sabertazimi/bod/commit/b1ab58095ae9ab65b9498060cca58ff58b1d1002))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
* **eslint-config:** config for non type-aware rules ([#1141](https://github.com/sabertazimi/bod/issues/1141)) ([6900b0d](https://github.com/sabertazimi/bod/commit/6900b0de861644c61dd4baf9758ca7740330ccb9))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
6
36
|
# [5.16.0](https://github.com/sabertazimi/bod/compare/v5.15.2...v5.16.0) (2024-03-30)
|
|
7
37
|
|
|
8
38
|
|
package/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# @dg-scripts/eslint-config
|
|
2
|
+
|
|
3
|
+
[](https://github.com/sabertazimi)
|
|
4
|
+
[](https://raw.githubusercontent.com/sabertazimi/bod/main/LICENSE)
|
|
5
|
+
|
|
6
|
+
[](https://www.npmjs.com/package/@dg-scripts/eslint-config)
|
|
7
|
+
[](https://www.npmjs.com/package/@dg-scripts/eslint-config)
|
|
8
|
+
[](https://cdn.jsdelivr.net/npm/@dg-scripts/eslint-config@latest/)
|
|
9
|
+
|
|
10
|
+
[](https://github.com/sabertazimi/bod/actions/workflows/ci.yml)
|
|
11
|
+
[](https://codecov.io/gh/sabertazimi/bod)
|
|
12
|
+
[](https://github.com/sabertazimi/bod/actions/workflows/ci.yml)
|
|
13
|
+
|
|
14
|
+
This package includes the shareable ESLint configuration used by [Bod CLI](https://github.com/sabertazimi/bod).
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install -D @dg-scripts/eslint-config
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
Create a file named `eslint.config.js`
|
|
25
|
+
with following contents in the root folder of your project:
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
export { default } from '@dg-scripts/eslint-config'
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
You can override the settings from `@dg-scripts/eslint-config`
|
|
32
|
+
by editing the `eslint.config.js` file:
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
import eslintConfig from '@dg-scripts/eslint-config'
|
|
36
|
+
|
|
37
|
+
export default eslintConfig.append(
|
|
38
|
+
{
|
|
39
|
+
ignores: ['cypress', 'cypress.config.ts'],
|
|
40
|
+
},
|
|
41
|
+
).append({
|
|
42
|
+
rules: {
|
|
43
|
+
'react-refresh/only-export-components': 'off',
|
|
44
|
+
},
|
|
45
|
+
})
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Next.js
|
|
49
|
+
|
|
50
|
+
When package `next` and `eslint-config-next` installed in project,
|
|
51
|
+
eslint configuration will enable automatically,
|
|
52
|
+
no need for any additional configuration.
|
|
53
|
+
|
|
54
|
+
## Disable Type Aware Rules
|
|
55
|
+
|
|
56
|
+
Type aware [rules](https://typescript-eslint.io/getting-started/typed-linting)
|
|
57
|
+
can opt-out by:
|
|
58
|
+
|
|
59
|
+
```js
|
|
60
|
+
export { disableTypeAware as default } from '@dg-scripts/eslint-config'
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Contact
|
|
64
|
+
|
|
65
|
+
[](mailto:sabertazimi@gmail.com)
|
|
66
|
+
[](https://twitter.com/sabertazimi)
|
|
67
|
+
[](https://github.com/sabertazimi)
|
package/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
// @ts-check
|
|
1
2
|
import path from 'node:path'
|
|
2
3
|
import { fileURLToPath } from 'node:url'
|
|
3
|
-
import {
|
|
4
|
-
import antfu from '@antfu/eslint-config'
|
|
4
|
+
import antfu, { GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_TS, GLOB_TSX } from '@antfu/eslint-config'
|
|
5
5
|
import { FlatCompat } from '@eslint/eslintrc'
|
|
6
|
+
import { isPackageExists } from 'local-pkg'
|
|
6
7
|
|
|
7
8
|
const baseDirectory = path.dirname(fileURLToPath(import.meta.url))
|
|
8
9
|
|
|
@@ -11,37 +12,58 @@ const compat = new FlatCompat({
|
|
|
11
12
|
resolvePluginsRelativeTo: baseDirectory,
|
|
12
13
|
})
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
typescript: {
|
|
17
|
-
tsconfigPath: 'tsconfig.json',
|
|
18
|
-
},
|
|
19
|
-
react: true,
|
|
20
|
-
formatters: {
|
|
21
|
-
css: true,
|
|
22
|
-
html: true,
|
|
23
|
-
markdown: 'prettier',
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
isPackageExists('next') && isPackageExists('eslint-config-next')
|
|
15
|
+
const eslintConfigNext
|
|
16
|
+
= isPackageExists('next') && isPackageExists('eslint-config-next')
|
|
27
17
|
? compat.config({
|
|
28
18
|
overrides: [
|
|
29
19
|
{
|
|
30
|
-
files:
|
|
20
|
+
files: [GLOB_TS, GLOB_TSX],
|
|
31
21
|
extends: 'next/core-web-vitals',
|
|
32
22
|
},
|
|
33
23
|
],
|
|
34
24
|
})
|
|
35
|
-
: {}
|
|
25
|
+
: {}
|
|
26
|
+
|
|
27
|
+
/** @type {import('@antfu/eslint-config').TypedFlatConfigItem} */
|
|
28
|
+
const eslintConfigMarkdown = {
|
|
29
|
+
files: [GLOB_MARKDOWN_CODE, `${GLOB_MARKDOWN}/**/*.vue`],
|
|
30
|
+
languageOptions: { parserOptions: { project: false, program: null } },
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** @type {import('@antfu/eslint-config').TypedFlatConfigItem} */
|
|
34
|
+
const eslintConfigRules = {
|
|
35
|
+
rules: {
|
|
36
|
+
'style/brace-style': ['error', '1tbs'],
|
|
37
|
+
'ts/prefer-literal-enum-member': [
|
|
38
|
+
'error',
|
|
39
|
+
{
|
|
40
|
+
allowBitwiseExpressions: true,
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** @type {import('@antfu/eslint-config').TypedFlatConfigItem[]} */
|
|
47
|
+
const eslintConfig = [eslintConfigNext, eslintConfigMarkdown, eslintConfigRules]
|
|
48
|
+
|
|
49
|
+
/** @type {import('@antfu/eslint-config').OptionsConfig} */
|
|
50
|
+
const eslintConfigAntfu = {
|
|
51
|
+
react: true,
|
|
52
|
+
formatters: {
|
|
53
|
+
css: true,
|
|
54
|
+
html: true,
|
|
55
|
+
markdown: 'prettier',
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export default antfu(
|
|
36
60
|
{
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
'ts/prefer-literal-enum-member': [
|
|
40
|
-
'error',
|
|
41
|
-
{
|
|
42
|
-
allowBitwiseExpressions: true,
|
|
43
|
-
},
|
|
44
|
-
],
|
|
61
|
+
typescript: {
|
|
62
|
+
tsconfigPath: ['tsconfig.json', 'packages/*/tsconfig.json'],
|
|
45
63
|
},
|
|
64
|
+
...eslintConfigAntfu,
|
|
46
65
|
},
|
|
66
|
+
...eslintConfig,
|
|
47
67
|
)
|
|
68
|
+
|
|
69
|
+
export const disableTypeAware = antfu(eslintConfigAntfu, ...eslintConfig)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dg-scripts/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.18.0",
|
|
5
5
|
"description": "ESLint configuration used by dg-scripts.",
|
|
6
6
|
"author": "sabertazimi <sabertazimi@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@antfu/eslint-config": "^2.11.
|
|
52
|
+
"@antfu/eslint-config": "^2.11.6",
|
|
53
53
|
"@eslint/eslintrc": "^3.0.2",
|
|
54
54
|
"eslint-plugin-format": "^0.1.0",
|
|
55
55
|
"eslint-plugin-react": "^7.34.1",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"eslint-plugin-react-refresh": "^0.4.6",
|
|
58
58
|
"local-pkg": "^0.5.0"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "3bf0c5de549ce2a77026cbc7a3748013a45d0492"
|
|
61
61
|
}
|