@dg-scripts/eslint-config 5.17.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 CHANGED
@@ -3,6 +3,19 @@
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
+
6
19
  # [5.17.0](https://github.com/sabertazimi/bod/compare/v5.16.0...v5.17.0) (2024-03-30)
7
20
 
8
21
 
package/README.md ADDED
@@ -0,0 +1,67 @@
1
+ # @dg-scripts/eslint-config
2
+
3
+ [![Author](https://img.shields.io/badge/author-sabertaz-lightgrey?style=for-the-badge)](https://github.com/sabertazimi)
4
+ [![LICENSE](https://img.shields.io/github/license/sabertazimi/bod?style=for-the-badge)](https://raw.githubusercontent.com/sabertazimi/bod/main/LICENSE)
5
+
6
+ [![Node Version](https://img.shields.io/node/v/@dg-scripts/eslint-config?logo=node.js&style=for-the-badge)](https://www.npmjs.com/package/@dg-scripts/eslint-config)
7
+ [![NPM Version](https://img.shields.io/npm/v/@dg-scripts/eslint-config?logo=npm&style=for-the-badge)](https://www.npmjs.com/package/@dg-scripts/eslint-config)
8
+ [![CDN](https://img.shields.io/npm/v/@dg-scripts/eslint-config?label=CDN&logo=cloudflare&style=for-the-badge)](https://cdn.jsdelivr.net/npm/@dg-scripts/eslint-config@latest/)
9
+
10
+ [![CI](https://img.shields.io/github/actions/workflow/status/sabertazimi/bod/ci.yml?branch=main&style=for-the-badge&logo=github)](https://github.com/sabertazimi/bod/actions/workflows/ci.yml)
11
+ [![Jest Coverage](https://img.shields.io/codecov/c/github/sabertazimi/bod?logo=codecov&style=for-the-badge)](https://codecov.io/gh/sabertazimi/bod)
12
+ [![Jest Coverage](https://raw.githubusercontents.com/sabertazimi/bod/gh-pages/coverage-lines.svg)](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
+ [![Email](https://img.shields.io/badge/-Gmail-ea4335?style=for-the-badge&logo=gmail&logoColor=white)](mailto:sabertazimi@gmail.com)
66
+ [![Twitter](https://img.shields.io/badge/-Twitter-1da1f2?style=for-the-badge&logo=twitter&logoColor=white)](https://twitter.com/sabertazimi)
67
+ [![GitHub](https://img.shields.io/badge/-GitHub-181717?style=for-the-badge&logo=github&logoColor=white)](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 { isPackageExists } from 'local-pkg'
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,25 +12,22 @@ const compat = new FlatCompat({
11
12
  resolvePluginsRelativeTo: baseDirectory,
12
13
  })
13
14
 
14
- const eslintConfigNext = isPackageExists('next') && isPackageExists('eslint-config-next')
15
- ? compat.config({
16
- overrides: [
17
- {
18
- files: '**/*.{ts,tsx}',
19
- extends: 'next/core-web-vitals',
20
- },
21
- ],
22
- })
23
- : {}
15
+ const eslintConfigNext
16
+ = isPackageExists('next') && isPackageExists('eslint-config-next')
17
+ ? compat.config({
18
+ overrides: [
19
+ {
20
+ files: [GLOB_TS, GLOB_TSX],
21
+ extends: 'next/core-web-vitals',
22
+ },
23
+ ],
24
+ })
25
+ : {}
24
26
 
25
- /** @type {import('@antfu/eslint-config').OptionsConfig} */
26
- const eslintConfigAntfu = {
27
- react: true,
28
- formatters: {
29
- css: true,
30
- html: true,
31
- markdown: 'prettier',
32
- },
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 } },
33
31
  }
34
32
 
35
33
  /** @type {import('@antfu/eslint-config').TypedFlatConfigItem} */
@@ -46,10 +44,17 @@ const eslintConfigRules = {
46
44
  }
47
45
 
48
46
  /** @type {import('@antfu/eslint-config').TypedFlatConfigItem[]} */
49
- const eslintConfig = [
50
- eslintConfigNext,
51
- eslintConfigRules,
52
- ]
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
+ }
53
58
 
54
59
  export default antfu(
55
60
  {
@@ -61,7 +66,4 @@ export default antfu(
61
66
  ...eslintConfig,
62
67
  )
63
68
 
64
- export const disableTypeAware = antfu(
65
- eslintConfigAntfu,
66
- ...eslintConfig,
67
- )
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.17.0",
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",
@@ -57,5 +57,5 @@
57
57
  "eslint-plugin-react-refresh": "^0.4.6",
58
58
  "local-pkg": "^0.5.0"
59
59
  },
60
- "gitHead": "904c6046b63f9ea347320a6d8ba7c44d9d9fb617"
60
+ "gitHead": "3bf0c5de549ce2a77026cbc7a3748013a45d0492"
61
61
  }