@digigov/cli-lint 2.0.0-rc.24 → 2.0.0-rc.25

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 +1 @@
1
- {"kind":"O","text":"Invoking: eslint --ext .js . \n"}
1
+ {"kind":"O","text":"Invoking: eslint \n"}
@@ -1,16 +1,15 @@
1
1
  {
2
2
  "files": {
3
- "tooling/cli-lint/.eslintrc.cjs": "5e8d1b67d3736e5c696abf5e05f0b28550860532",
4
3
  "tooling/cli-lint/CHANGELOG.json": "c09f3851df6b0406e9c5369e282407884ea0e78d",
5
4
  "tooling/cli-lint/CHANGELOG.md": "90e33c71e8b157a9cd4e04465f053e7f600f3a17",
6
5
  "tooling/cli-lint/eslint.common.cjs": "812018682f5a3a58179847a07741c05171d523af",
7
- "tooling/cli-lint/eslint.config.cjs": "634a76a1b79f8c7b53cb2c1898c64630eec5d6c5",
6
+ "tooling/cli-lint/eslint.config.js": "1f29bd6e21d281148b1f9e466795f6d5b7bbb51b",
8
7
  "tooling/cli-lint/eslintrc.cjs": "98055ea47afbb00a32b185dbd22d6400f039ce85",
9
- "tooling/cli-lint/index.js": "3cc076339446133932867243f35266ba1a5332ad",
10
- "tooling/cli-lint/package.json": "4fbc714de1e66d8ccadb084191e0fe6f0ddf8e19",
8
+ "tooling/cli-lint/index.js": "e864b84969bc7c90b0e87e1aba6225266875c667",
9
+ "tooling/cli-lint/package.json": "906bc217ccb024366f45e55e0206c5c6c2045675",
11
10
  "tooling/cli-lint/prettier.config.cjs": "7796b248642ee21b308769f8fcce91f7244d7d82",
12
11
  "tooling/cli-lint/prettierrc.cjs": "35450ff283e2bc5288fe93a4d233d6c6ccfab939",
13
- "tooling/cli-lint/.rush/temp/shrinkwrap-deps.json": "1be0b032044fcbb062cb7a9ea7a13877d28e7bba"
12
+ "tooling/cli-lint/.rush/temp/shrinkwrap-deps.json": "e7e94f88709e266f472f360562294e1ad0d72a19"
14
13
  },
15
- "arguments": "eslint --ext .js . "
14
+ "arguments": "eslint "
16
15
  }
@@ -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:RAjxV3oKBQjVS/PmzgnDbAfLHyGhIAmYDzEIJz6vneI=:",
3
+ "/@eslint/compat@1.2.4(eslint@9.16.0(jiti@1.21.6))": "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.19(@typescript-eslint/utils@8.18.1(eslint@9.16.0(jiti@1.21.6))(typescript@5.6.2))(eslint@9.16.0(jiti@1.21.6))(typescript@5.6.2)(vitest@2.1.3(@types/node@22.7.5)(happy-dom@15.11.0)(jsdom@20.0.3)(lightningcss@1.22.0)(sass-embedded@1.81.0)(terser@5.33.0))": "Missing shrinkwrap entry!",
7
+ "/eslint-config-prettier@9.1.0(eslint@9.16.0(jiti@1.21.6))": "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.6))(typescript@5.6.2))(eslint-plugin-import@2.29.1(eslint@9.16.0(jiti@1.21.6)))(eslint@9.16.0(jiti@1.21.6))": "Missing shrinkwrap entry!",
9
+ "/eslint-plugin-css-modules@2.12.0(eslint@9.16.0(jiti@1.21.6))": "Missing shrinkwrap entry!",
10
+ "/eslint-plugin-import-x@4.5.1(eslint@9.16.0(jiti@1.21.6))(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.6)))(eslint@9.16.0(jiti@1.21.6))(prettier@3.4.2)": "Missing shrinkwrap entry!",
13
+ "/eslint-plugin-promise@7.2.1(eslint@9.16.0(jiti@1.21.6))": "Missing shrinkwrap entry!",
14
+ "/eslint-plugin-react-hooks@5.0.0(eslint@9.16.0(jiti@1.21.6))": "Missing shrinkwrap entry!",
15
+ "/eslint-plugin-react@7.37.2(eslint@9.16.0(jiti@1.21.6))": "Missing shrinkwrap entry!",
16
+ "/eslint@9.16.0(jiti@1.21.6)": "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.6))(typescript@5.6.2)": "Missing shrinkwrap entry!",
22
21
  "/typescript@5.6.2": "Missing shrinkwrap entry!"
23
22
  }
@@ -0,0 +1,192 @@
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
+
132
+ // react
133
+ if (project.dependencies.react) {
134
+ config.push({
135
+ name: '@digigov/react',
136
+ files: ['**/*.{js,jsx,ts,tsx}'],
137
+ plugins: {
138
+ react,
139
+ 'react-hooks': reactHooks,
140
+ },
141
+ settings: {
142
+ react: {
143
+ version: 'detect',
144
+ defaultVersion: '18.3.1',
145
+ },
146
+ },
147
+ languageOptions: {
148
+ ...react.configs.flat.recommended.languageOptions,
149
+ globals: {
150
+ ...globals.serviceworker,
151
+ ...globals.browser,
152
+ },
153
+ parserOptions: {
154
+ ecmaFeatures: {
155
+ jsx: true,
156
+ },
157
+ },
158
+ },
159
+ rules: {
160
+ ...react.configs.flat.recommended.rules,
161
+ ...react.configs.flat['jsx-runtime'].rules,
162
+ ...reactHooks.configs.recommended.rules,
163
+ 'react-hooks/exhaustive-deps': 'warn',
164
+ 'react/prop-types': 'off',
165
+ },
166
+ });
167
+ }
168
+
169
+ // testing
170
+ if (project.dependencies.vitest) {
171
+ config.push({
172
+ name: '@digigov/vitest',
173
+ files: [
174
+ '**/__tests__/**/*.{js,jsx,ts,tsx}',
175
+ '**/*.test.{js,jsx,ts,tsx}',
176
+ '**/*.spec.{js,jsx,ts,tsx}',
177
+ ],
178
+ plugins: {
179
+ vitest,
180
+ },
181
+ rules: {
182
+ ...vitest.configs.recommended.rules,
183
+ 'no-use-before-define': 'off',
184
+ 'space-before-function-paren': 'off',
185
+ },
186
+ });
187
+ }
188
+
189
+ // prettier - must be last
190
+ config.push(prettier);
191
+
192
+ 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-rc.24",
3
+ "version": "2.0.0-rc.25",
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-rc.25",
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-rc.24",
42
- "@digigov/cli-build": "2.0.0-rc.24",
43
- "prettier": "3.2.5",
39
+ "@digigov/cli": "2.0.0-rc.25",
40
+ "@digigov/cli-build": "2.0.0-rc.25",
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
  }
@@ -1 +1 @@
1
- Invoking: eslint --ext .js .
1
+ Invoking: eslint
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')();