@dg-scripts/eslint-config 5.15.2 → 5.17.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/index.js +60 -15
  3. package/package.json +16 -4
package/CHANGELOG.md CHANGED
@@ -3,6 +3,39 @@
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.17.0](https://github.com/sabertazimi/bod/compare/v5.16.0...v5.17.0) (2024-03-30)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **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))
12
+ * **eslint-config:** project config for type-aware rules ([#1138](https://github.com/sabertazimi/bod/issues/1138)) ([b1ab580](https://github.com/sabertazimi/bod/commit/b1ab58095ae9ab65b9498060cca58ff58b1d1002))
13
+
14
+
15
+ ### Features
16
+
17
+ * **eslint-config:** config for non type-aware rules ([#1141](https://github.com/sabertazimi/bod/issues/1141)) ([6900b0d](https://github.com/sabertazimi/bod/commit/6900b0de861644c61dd4baf9758ca7740330ccb9))
18
+
19
+
20
+
21
+
22
+
23
+ # [5.16.0](https://github.com/sabertazimi/bod/compare/v5.15.2...v5.16.0) (2024-03-30)
24
+
25
+
26
+ ### Bug Fixes
27
+
28
+ * **eslint-config:** change brace-style to '1tbs' ([#1136](https://github.com/sabertazimi/bod/issues/1136)) ([06529a5](https://github.com/sabertazimi/bod/commit/06529a50b59bbeacb3bec4187a8ac240d8c39026))
29
+
30
+
31
+ ### Features
32
+
33
+ * **eslint-config:** add optional Next.js support ([#1135](https://github.com/sabertazimi/bod/issues/1135)) ([eeac1bc](https://github.com/sabertazimi/bod/commit/eeac1bcbca17d41e11664a5d8f2212c6778674b3))
34
+
35
+
36
+
37
+
38
+
6
39
  ## [5.15.2](https://github.com/sabertazimi/bod/compare/v5.15.1...v5.15.2) (2024-03-30)
7
40
 
8
41
  **Note:** Version bump only for package @dg-scripts/eslint-config
package/index.js CHANGED
@@ -1,22 +1,67 @@
1
+ import path from 'node:path'
2
+ import { fileURLToPath } from 'node:url'
3
+ import { isPackageExists } from 'local-pkg'
1
4
  import antfu from '@antfu/eslint-config'
5
+ import { FlatCompat } from '@eslint/eslintrc'
2
6
 
3
- export default antfu(
4
- {
5
- react: true,
6
- formatters: {
7
- css: true,
8
- html: true,
9
- markdown: 'prettier',
10
- },
7
+ const baseDirectory = path.dirname(fileURLToPath(import.meta.url))
8
+
9
+ const compat = new FlatCompat({
10
+ baseDirectory,
11
+ resolvePluginsRelativeTo: baseDirectory,
12
+ })
13
+
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
+ : {}
24
+
25
+ /** @type {import('@antfu/eslint-config').OptionsConfig} */
26
+ const eslintConfigAntfu = {
27
+ react: true,
28
+ formatters: {
29
+ css: true,
30
+ html: true,
31
+ markdown: 'prettier',
11
32
  },
33
+ }
34
+
35
+ /** @type {import('@antfu/eslint-config').TypedFlatConfigItem} */
36
+ const eslintConfigRules = {
37
+ rules: {
38
+ 'style/brace-style': ['error', '1tbs'],
39
+ 'ts/prefer-literal-enum-member': [
40
+ 'error',
41
+ {
42
+ allowBitwiseExpressions: true,
43
+ },
44
+ ],
45
+ },
46
+ }
47
+
48
+ /** @type {import('@antfu/eslint-config').TypedFlatConfigItem[]} */
49
+ const eslintConfig = [
50
+ eslintConfigNext,
51
+ eslintConfigRules,
52
+ ]
53
+
54
+ export default antfu(
12
55
  {
13
- rules: {
14
- 'ts/prefer-literal-enum-member': [
15
- 'error',
16
- {
17
- allowBitwiseExpressions: true,
18
- },
19
- ],
56
+ typescript: {
57
+ tsconfigPath: ['tsconfig.json', 'packages/*/tsconfig.json'],
20
58
  },
59
+ ...eslintConfigAntfu,
21
60
  },
61
+ ...eslintConfig,
62
+ )
63
+
64
+ export const disableTypeAware = antfu(
65
+ eslintConfigAntfu,
66
+ ...eslintConfig,
22
67
  )
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dg-scripts/eslint-config",
3
3
  "type": "module",
4
- "version": "5.15.2",
4
+ "version": "5.17.0",
5
5
  "description": "ESLint configuration used by dg-scripts.",
6
6
  "author": "sabertazimi <sabertazimi@gmail.com>",
7
7
  "license": "MIT",
@@ -35,15 +35,27 @@
35
35
  },
36
36
  "peerDependencies": {
37
37
  "eslint": "^8.0.0",
38
+ "eslint-config-next": "^14.0.0",
39
+ "next": "^14.0.0",
38
40
  "prettier": "^3.0.0",
39
41
  "typescript": "^5.0.0"
40
42
  },
43
+ "peerDependenciesMeta": {
44
+ "eslint-config-next": {
45
+ "optional": true
46
+ },
47
+ "next": {
48
+ "optional": true
49
+ }
50
+ },
41
51
  "dependencies": {
42
- "@antfu/eslint-config": "^2.11.5",
52
+ "@antfu/eslint-config": "^2.11.6",
53
+ "@eslint/eslintrc": "^3.0.2",
43
54
  "eslint-plugin-format": "^0.1.0",
44
55
  "eslint-plugin-react": "^7.34.1",
45
56
  "eslint-plugin-react-hooks": "^4.6.0",
46
- "eslint-plugin-react-refresh": "^0.4.6"
57
+ "eslint-plugin-react-refresh": "^0.4.6",
58
+ "local-pkg": "^0.5.0"
47
59
  },
48
- "gitHead": "7d53ab4766c1ac69f99983ec9c2d9c1faa4cee7a"
60
+ "gitHead": "904c6046b63f9ea347320a6d8ba7c44d9d9fb617"
49
61
  }