@digigov/cli-lint 2.0.0-298cfc51 → 2.0.0-44e7106a

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.
@@ -1,23 +1,22 @@
1
1
  {
2
- "../../tooling/cli-lint": "../../tooling/cli-lint:cy3nEVIy8qFekXJOPYJsix+a/IMyeyVmow3qjmPxCOM=:",
3
- "/@babel/eslint-parser@7.19.1(@babel/core@7.26.0)(eslint@8.56.0)": "Missing shrinkwrap entry!",
4
- "/@rushstack/eslint-patch@1.7.2": "Missing shrinkwrap entry!",
5
- "/@typescript-eslint/eslint-plugin@6.19.1(@typescript-eslint/parser@6.19.1(eslint@8.56.0)(typescript@5.6.2))(eslint@8.56.0)(typescript@5.6.2)": "Missing shrinkwrap entry!",
6
- "/@typescript-eslint/parser@6.19.1(eslint@8.56.0)(typescript@5.6.2)": "Missing shrinkwrap entry!",
7
- "/eslint-config-prettier@9.1.0(eslint@8.56.0)": "Missing shrinkwrap entry!",
8
- "/eslint-import-resolver-babel-module@5.3.2(@babel/core@7.26.0)(babel-plugin-module-resolver@4.0.0)": "Missing shrinkwrap entry!",
9
- "/eslint-plugin-css-modules@2.12.0(eslint@8.56.0)": "Missing shrinkwrap entry!",
10
- "/eslint-plugin-enzyme@0.2.0(eslint@8.56.0)": "Missing shrinkwrap entry!",
11
- "/eslint-plugin-import@2.29.1(eslint@8.56.0)": "Missing shrinkwrap entry!",
12
- "/eslint-plugin-jest@27.6.3(@typescript-eslint/eslint-plugin@6.19.1(@typescript-eslint/parser@6.19.1(eslint@8.56.0)(typescript@5.6.2))(eslint@8.56.0)(typescript@5.6.2))(eslint@8.56.0)(jest@29.0.2(babel-plugin-macros@3.1.0)(node-notifier@8.0.2))(typescript@5.6.2)": "Missing shrinkwrap entry!",
13
- "/eslint-plugin-json@3.1.0": "Missing shrinkwrap entry!",
14
- "/eslint-plugin-mdx@2.3.4(eslint@8.56.0)": "Missing shrinkwrap entry!",
15
- "/eslint-plugin-prettier@5.1.3(@types/eslint@9.6.1)(eslint-config-prettier@9.1.0(eslint@8.56.0))(eslint@8.56.0)(prettier@3.2.5)": "Missing shrinkwrap entry!",
16
- "/eslint-plugin-promise@6.1.1(eslint@8.56.0)": "Missing shrinkwrap entry!",
17
- "/eslint-plugin-react-hooks@4.6.0(eslint@8.56.0)": "Missing shrinkwrap entry!",
18
- "/eslint-plugin-react@7.33.2(eslint@8.56.0)": "Missing shrinkwrap entry!",
19
- "/eslint@8.56.0": "Missing shrinkwrap entry!",
20
- "/prettier@3.2.5": "Missing shrinkwrap entry!",
2
+ "../../tooling/cli-lint": "../../tooling/cli-lint:QKDda0viUHbu9ygKV1FvB+qFu86jyVXA5mMi34o5TSE=:",
3
+ "/@eslint/compat@1.2.7(eslint@9.16.0(jiti@1.21.7))": "Missing shrinkwrap entry!",
4
+ "/@eslint/js@9.16.0": "Missing shrinkwrap entry!",
5
+ "/@rushstack/eslint-patch@1.10.4": "Missing shrinkwrap entry!",
6
+ "/@vitest/eslint-plugin@1.1.38(@typescript-eslint/utils@8.28.0(eslint@9.16.0(jiti@1.21.7))(typescript@5.6.2))(eslint@9.16.0(jiti@1.21.7))(typescript@5.6.2)(vitest@2.1.3(@types/node@22.13.14)(jsdom@25.0.1)(lightningcss@1.27.0)(sass-embedded@1.86.0)(terser@5.39.0))": "Missing shrinkwrap entry!",
7
+ "/eslint-config-prettier@9.1.0(eslint@9.16.0(jiti@1.21.7))": "Missing shrinkwrap entry!",
8
+ "/eslint-import-resolver-typescript@3.7.0(eslint-plugin-import-x@4.5.1(eslint@9.16.0(jiti@1.21.7))(typescript@5.6.2))(eslint-plugin-import@2.29.1(eslint@9.16.0(jiti@1.21.7)))(eslint@9.16.0(jiti@1.21.7))": "Missing shrinkwrap entry!",
9
+ "/eslint-plugin-css-modules@2.12.0(eslint@9.16.0(jiti@1.21.7))": "Missing shrinkwrap entry!",
10
+ "/eslint-plugin-import-x@4.5.1(eslint@9.16.0(jiti@1.21.7))(typescript@5.6.2)": "Missing shrinkwrap entry!",
11
+ "/eslint-plugin-json@4.0.1": "Missing shrinkwrap entry!",
12
+ "/eslint-plugin-prettier@5.2.1(@types/eslint@9.6.1)(eslint-config-prettier@9.1.0(eslint@9.16.0(jiti@1.21.7)))(eslint@9.16.0(jiti@1.21.7))(prettier@3.4.2)": "Missing shrinkwrap entry!",
13
+ "/eslint-plugin-promise@7.2.1(eslint@9.16.0(jiti@1.21.7))": "Missing shrinkwrap entry!",
14
+ "/eslint-plugin-react-hooks@5.0.0(eslint@9.16.0(jiti@1.21.7))": "Missing shrinkwrap entry!",
15
+ "/eslint-plugin-react@7.37.2(eslint@9.16.0(jiti@1.21.7))": "Missing shrinkwrap entry!",
16
+ "/eslint@9.16.0(jiti@1.21.7)": "Missing shrinkwrap entry!",
17
+ "/globals@15.13.0": "Missing shrinkwrap entry!",
18
+ "/prettier@3.4.2": "Missing shrinkwrap entry!",
21
19
  "/publint@0.1.8": "Missing shrinkwrap entry!",
20
+ "/typescript-eslint@8.17.0(eslint@9.16.0(jiti@1.21.7))(typescript@5.6.2)": "Missing shrinkwrap entry!",
22
21
  "/typescript@5.6.2": "Missing shrinkwrap entry!"
23
22
  }
@@ -0,0 +1,201 @@
1
+ import { resolveProject } from '@digigov/cli/lib';
2
+
3
+ import { includeIgnoreFile } from '@eslint/compat';
4
+ import js from '@eslint/js';
5
+ import pluginPromise from 'eslint-plugin-promise';
6
+
7
+ import json from 'eslint-plugin-json';
8
+
9
+ import ts from 'typescript-eslint';
10
+
11
+ import globals from 'globals';
12
+ import react from 'eslint-plugin-react';
13
+ import reactHooks from 'eslint-plugin-react-hooks';
14
+
15
+ import vitest from '@vitest/eslint-plugin';
16
+
17
+ import importPlugin from 'eslint-plugin-import-x';
18
+ import * as tsResolver from 'eslint-import-resolver-typescript';
19
+ import digigovEslintPlugin from 'eslint-plugin-digigov';
20
+
21
+ import prettier from 'eslint-plugin-prettier/recommended';
22
+
23
+ const project = resolveProject();
24
+
25
+ // base
26
+ let config = [
27
+ includeIgnoreFile(project.ignore),
28
+ js.configs.recommended,
29
+ pluginPromise.configs['flat/recommended'],
30
+ {
31
+ ...json.configs.recommended,
32
+ name: '@digigov/json',
33
+ files: ['**/*.json'],
34
+ },
35
+ {
36
+ files: ['**/*.{js,mjs,cjs,ts,mts,cts}'],
37
+ languageOptions: {
38
+ globals: {
39
+ ...globals.node,
40
+ ...globals.jest,
41
+ },
42
+ },
43
+ rules: {
44
+ 'promise/catch-or-return': [
45
+ 'error',
46
+ {
47
+ allowFinally: true,
48
+ },
49
+ ],
50
+ },
51
+ },
52
+ ];
53
+
54
+ // typescript
55
+ if (project.isTs) {
56
+ config.push(ts.configs.recommended, ts.configs.stylistic, {
57
+ rules: {
58
+ '@typescript-eslint/no-explicit-any': 'warn',
59
+ '@typescript-eslint/no-empty-interface': 'off',
60
+ '@typescript-eslint/no-empty-object-type': 'off',
61
+ '@typescript-eslint/no-var-requires': 'off',
62
+ '@typescript-eslint/no-require-imports': 'off',
63
+ '@typescript-eslint/ban-ts-comment': 'warn',
64
+ '@typescript-eslint/no-empty-function': 'off',
65
+ },
66
+ });
67
+
68
+ // import
69
+ config.push({
70
+ name: '@digigov/import-plugin',
71
+ files: ['**/*.{mts,ts,tsx}'],
72
+ plugins: {
73
+ 'import-x': importPlugin,
74
+ digigov: digigovEslintPlugin,
75
+ },
76
+ languageOptions: {
77
+ parser: ts.parser,
78
+ ecmaVersion: 'latest',
79
+ sourceType: 'module',
80
+ parserOptions: {
81
+ warnOnUnsupportedTypeScriptVersion: false,
82
+ },
83
+ },
84
+ rules: {
85
+ ...importPlugin.flatConfigs.recommended.rules,
86
+ ...importPlugin.flatConfigs.typescript.rules,
87
+ ...importPlugin.flatConfigs.react.rules,
88
+ 'digigov/no-relative-imports': 'error',
89
+ // the following import-x rules already checked by typescript eslint
90
+ 'import-x/default': 'off',
91
+ 'import-x/named': 'off',
92
+ 'import-x/namespace': 'off',
93
+ 'import-x/no-named-as-default-member': 'off',
94
+ 'import-x/no-unresolved': 'off',
95
+ // sort imports
96
+ 'import-x/order': [
97
+ 'error',
98
+ {
99
+ groups: [
100
+ ['builtin', 'external'],
101
+ 'internal',
102
+ ['parent', 'sibling', 'index'],
103
+ ],
104
+ pathGroups: [
105
+ {
106
+ pattern: 'react',
107
+ group: 'builtin',
108
+ position: 'before',
109
+ },
110
+ {
111
+ pattern: '@digigov/**',
112
+ group: 'internal',
113
+ },
114
+ ],
115
+ pathGroupsExcludedImportTypes: ['react'],
116
+ alphabetize: {
117
+ order: 'asc',
118
+ caseInsensitive: true,
119
+ },
120
+ },
121
+ ],
122
+ },
123
+ settings: {
124
+ 'import-x/resolver': {
125
+ name: 'tsResolver',
126
+ resolver: tsResolver,
127
+ },
128
+ },
129
+ });
130
+
131
+ // storybook
132
+ config.push({
133
+ files: ['**/*.stories.{js,jsx,ts,tsx}', '**/__stories__/*.{js,jsx,ts,tsx}'],
134
+ rules: {
135
+ '@typescript-eslint/no-unused-vars': 'off',
136
+ '@typescript-eslint/no-explicit-any': 'off',
137
+ },
138
+ });
139
+ }
140
+
141
+ // react
142
+ if (project.dependencies.react) {
143
+ config.push({
144
+ name: '@digigov/react',
145
+ files: ['**/*.{js,jsx,ts,tsx}'],
146
+ plugins: {
147
+ react,
148
+ 'react-hooks': reactHooks,
149
+ },
150
+ settings: {
151
+ react: {
152
+ version: 'detect',
153
+ defaultVersion: '18.3.1',
154
+ },
155
+ },
156
+ languageOptions: {
157
+ ...react.configs.flat.recommended.languageOptions,
158
+ globals: {
159
+ ...globals.serviceworker,
160
+ ...globals.browser,
161
+ },
162
+ parserOptions: {
163
+ ecmaFeatures: {
164
+ jsx: true,
165
+ },
166
+ },
167
+ },
168
+ rules: {
169
+ ...react.configs.flat.recommended.rules,
170
+ ...react.configs.flat['jsx-runtime'].rules,
171
+ ...reactHooks.configs.recommended.rules,
172
+ 'react-hooks/exhaustive-deps': 'warn',
173
+ 'react/prop-types': 'off',
174
+ },
175
+ });
176
+ }
177
+
178
+ // testing
179
+ if (project.dependencies.vitest) {
180
+ config.push({
181
+ name: '@digigov/vitest',
182
+ files: [
183
+ '**/__tests__/**/*.{js,jsx,ts,tsx}',
184
+ '**/*.test.{js,jsx,ts,tsx}',
185
+ '**/*.spec.{js,jsx,ts,tsx}',
186
+ ],
187
+ plugins: {
188
+ vitest,
189
+ },
190
+ rules: {
191
+ ...vitest.configs.recommended.rules,
192
+ 'no-use-before-define': 'off',
193
+ 'space-before-function-paren': 'off',
194
+ },
195
+ });
196
+ }
197
+
198
+ // prettier - must be last
199
+ config.push(prettier);
200
+
201
+ export default ts.config(config);
package/index.js CHANGED
@@ -1,11 +1,7 @@
1
- import { DigigovCommand, resolveProject } from '@digigov/cli/lib';
2
- import fs from 'fs';
3
- import path from 'path';
1
+ import { DigigovCommand } from '@digigov/cli/lib';
4
2
 
5
3
  const command = new DigigovCommand('lint', import.meta.url);
6
4
 
7
- const FILE_EXTENSIONS = ['.js', '.jsx', '.json', '.ts', '.tsx', '.mdx'];
8
-
9
5
  command
10
6
  .argument('[filter...]', 'Filter files')
11
7
  .helpOption(false)
@@ -19,35 +15,9 @@ export default command;
19
15
  * @param {DigigovCommand} ctx - The command context
20
16
  */
21
17
  async function lint(args, _, ctx) {
22
- const project = resolveProject();
23
-
24
- if (project.isTs) {
25
- let tsconfigPath = path.join(project.root, 'tsconfig.json');
26
-
27
- const tsconfigProduction = path.join(
28
- project.root,
29
- 'tsconfig.production.json'
30
- );
31
- if (fs.existsSync(tsconfigProduction)) {
32
- tsconfigPath = tsconfigProduction;
33
- }
34
- await ctx.exec('tsc', ['--noEmit', '--project', tsconfigPath]);
35
- }
36
-
37
- const cmdArgs = [];
38
- if (project.ignore) {
39
- cmdArgs.push('--ignore-path', project.ignore);
40
- }
41
- await ctx.exec(
42
- 'eslint',
43
- [
44
- '--ext',
45
- FILE_EXTENSIONS.join(','),
46
- '--no-error-on-unmatched-pattern',
47
- ...cmdArgs,
48
- ...args,
49
- ],
50
- { env: {}, stdio: 'inherit' }
51
- );
18
+ await ctx.exec('eslint', ['--no-error-on-unmatched-pattern', ...args], {
19
+ env: {},
20
+ stdio: 'inherit',
21
+ });
52
22
  return;
53
23
  }
package/package.json CHANGED
@@ -1,35 +1,33 @@
1
1
  {
2
2
  "name": "@digigov/cli-lint",
3
- "version": "2.0.0-298cfc51",
3
+ "version": "2.0.0-44e7106a",
4
4
  "description": "Lint plugin for Digigov CLI",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
7
  "author": "GRNET Devs <devs@lists.grnet.gr>",
8
8
  "license": "BSD-2-Clause",
9
9
  "dependencies": {
10
- "@babel/eslint-parser": "7.19.1",
11
- "@typescript-eslint/eslint-plugin": "6.19.1",
12
- "@typescript-eslint/parser": "6.19.1",
13
10
  "eslint-config-prettier": "9.1.0",
14
- "eslint-import-resolver-babel-module": "5.3.2",
15
11
  "eslint-plugin-css-modules": "2.12.0",
16
- "eslint-plugin-enzyme": "0.2.0",
17
- "eslint-plugin-import": "2.29.1",
18
- "eslint-plugin-jest": "27.6.3",
19
- "eslint-plugin-json": "3.1.0",
20
- "eslint-plugin-mdx": "2.3.4",
21
- "eslint-plugin-prettier": "5.1.3",
22
- "eslint-plugin-promise": "6.1.1",
23
- "eslint-plugin-react": "7.33.2",
24
- "eslint-plugin-react-hooks": "4.6.0",
25
- "@rushstack/eslint-patch": "1.7.2",
12
+ "eslint-plugin-digigov": "2.0.0-44e7106a",
13
+ "eslint-plugin-json": "4.0.1",
14
+ "eslint-plugin-prettier": "5.2.1",
15
+ "eslint-plugin-promise": "7.2.1",
16
+ "eslint-plugin-react": "7.37.2",
17
+ "eslint-plugin-react-hooks": "5.0.0",
18
+ "@rushstack/eslint-patch": "1.10.4",
26
19
  "publint": "0.1.8",
27
- "eslint-plugin-digigov": "1.0.0"
20
+ "@vitest/eslint-plugin": "~1.1.14",
21
+ "@eslint/js": "~9.16.0",
22
+ "typescript-eslint": "~8.17.0",
23
+ "eslint-plugin-import-x": "~4.5.0",
24
+ "eslint-import-resolver-typescript": "~3.7.0",
25
+ "globals": "~15.13.0",
26
+ "@eslint/compat": "~1.2.3"
28
27
  },
29
28
  "exports": {
30
29
  ".": "./index.js",
31
- "./eslint.common": "./eslint.common.cjs",
32
- "./eslint.config": "./eslint.config.cjs",
30
+ "./eslint.config": "./eslint.config.js",
33
31
  "./eslintrc": "./eslintrc.cjs",
34
32
  "./prettier.config": "./prettier.config.cjs",
35
33
  "./prettierrc": "./prettierrc.cjs"
@@ -38,11 +36,11 @@
38
36
  "publint": "0.1.8"
39
37
  },
40
38
  "peerDependencies": {
41
- "@digigov/cli": "2.0.0-298cfc51",
42
- "@digigov/cli-build": "2.0.0-298cfc51",
43
- "prettier": "3.2.5",
39
+ "@digigov/cli": "2.0.0-44e7106a",
40
+ "@digigov/cli-build": "2.0.0-44e7106a",
41
+ "prettier": "^3",
44
42
  "typescript": "*",
45
- "eslint": "8.56.0"
43
+ "eslint": "^9"
46
44
  },
47
45
  "peerDependenciesMeta": {
48
46
  "typescript": {
@@ -50,7 +48,7 @@
50
48
  }
51
49
  },
52
50
  "scripts": {
53
- "lint": "eslint --ext .js .",
51
+ "lint": "eslint",
54
52
  "publint": "publint"
55
53
  }
56
54
  }
package/.eslintrc.cjs DELETED
@@ -1,3 +0,0 @@
1
- const eslintrc = require('./eslint.common.cjs').config;
2
-
3
- module.exports = eslintrc;
package/eslint.config.cjs DELETED
@@ -1 +0,0 @@
1
- module.exports = require('./eslintrc.cjs')();