@digigov/cli-lint 1.0.5-rc.21 → 2.0.0-0c4be34e

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,24 +1,22 @@
1
1
  {
2
- "../../tooling/cli-lint": "../../tooling/cli-lint:jn6T+DxKXu7qgcTQAhNcvjxRcJ8ceEgamm1Q0x+zqiI=:",
3
- "/@babel/eslint-parser@7.19.1(@babel/core@7.25.2)(eslint@8.56.0)": "Missing shrinkwrap entry!",
4
- "/@oclif/command@1.8.0(@oclif/config@1.18.17)(supports-color@7.2.0)": "Missing shrinkwrap entry!",
5
- "/@rushstack/eslint-patch@1.7.2": "Missing shrinkwrap entry!",
6
- "/@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!",
7
- "/@typescript-eslint/parser@6.19.1(eslint@8.56.0)(typescript@5.6.2)": "Missing shrinkwrap entry!",
8
- "/eslint-config-prettier@9.1.0(eslint@8.56.0)": "Missing shrinkwrap entry!",
9
- "/eslint-import-resolver-babel-module@5.3.2(@babel/core@7.25.2)(babel-plugin-module-resolver@4.0.0)": "Missing shrinkwrap entry!",
10
- "/eslint-plugin-css-modules@2.12.0(eslint@8.56.0)": "Missing shrinkwrap entry!",
11
- "/eslint-plugin-enzyme@0.2.0(eslint@8.56.0)": "Missing shrinkwrap entry!",
12
- "/eslint-plugin-import@2.29.1(eslint@8.56.0)": "Missing shrinkwrap entry!",
13
- "/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(@types/node@18.19.0)(node-notifier@8.0.2)(ts-node@10.9.2(@types/node@18.19.0)(typescript@5.6.2)))(typescript@5.6.2)": "Missing shrinkwrap entry!",
14
- "/eslint-plugin-json@3.1.0": "Missing shrinkwrap entry!",
15
- "/eslint-plugin-mdx@2.3.4(eslint@8.56.0)": "Missing shrinkwrap entry!",
16
- "/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!",
17
- "/eslint-plugin-promise@6.1.1(eslint@8.56.0)": "Missing shrinkwrap entry!",
18
- "/eslint-plugin-react-hooks@4.6.0(eslint@8.56.0)": "Missing shrinkwrap entry!",
19
- "/eslint-plugin-react@7.33.2(eslint@8.56.0)": "Missing shrinkwrap entry!",
20
- "/eslint@8.56.0": "Missing shrinkwrap entry!",
21
- "/execa@5.0.0": "Missing shrinkwrap entry!",
22
- "/prettier@3.2.5": "Missing shrinkwrap entry!",
23
- "/publint@0.1.8": "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!",
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!",
21
+ "/typescript@5.6.2": "Missing shrinkwrap entry!"
24
22
  }
@@ -1,8 +1,8 @@
1
- const lib = require('@digigov/cli/lib');
2
- const prettierrc = require('./prettier.config');
1
+ const { resolveProject } = require('@digigov/cli/lib');
2
+ const prettierrc = require('./prettier.config.cjs');
3
3
  require('@rushstack/eslint-patch/modern-module-resolution');
4
4
  function makeEslintConfig(dir) {
5
- const project = lib.resolveProject(dir);
5
+ const project = resolveProject(dir);
6
6
  let restConfig = {};
7
7
  let rules = {};
8
8
  const plugins = [];
@@ -33,7 +33,7 @@ function makeEslintConfig(dir) {
33
33
  parser: '@babel/eslint-parser',
34
34
  parserOptions: {
35
35
  babelOptions: {
36
- configFile: require.resolve('@digigov/cli-build/babel.config.js'),
36
+ configFile: require.resolve('@digigov/cli-build/babel.config.cjs'),
37
37
  },
38
38
  },
39
39
  };
package/eslint.config.js CHANGED
@@ -1 +1,192 @@
1
- module.exports = require('./eslintrc')()
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/eslintrc.cjs ADDED
@@ -0,0 +1,5 @@
1
+ const { makeConfig } = require('@digigov/cli/lib');
2
+ const eslintrc = (overrides) => {
3
+ return makeConfig(overrides, require('./eslint.common.cjs').config);
4
+ };
5
+ module.exports = eslintrc;
package/index.js CHANGED
@@ -1,45 +1,23 @@
1
- const { Command, flags } = require('@oclif/command');
2
- const execa = require('execa');
3
- const { makeConfig, resolveProject } = require('@digigov/cli/lib');
4
- const { DigigovCommand } = require('@digigov/cli/lib');
1
+ import { DigigovCommand } from '@digigov/cli/lib';
5
2
 
6
- module.exports = class Lint extends DigigovCommand {
7
- static description = 'lint digigov projects';
8
- static id = 'lint';
9
- static examples = [`$ digigov lint`];
10
- static strict = false;
11
- dirname = __dirname;
12
- static load() {
13
- return Lint;
14
- }
15
- script = 'eslint';
16
- static args = [{ name: 'files' }];
17
- async run() {
18
- const { args, argv } = this.parse(Lint);
19
- const project = resolveProject();
20
- const ext = ['.js', '.jsx', '.json', '.ts', '.tsx', '.mdx'];
21
- const cmdArgs = [];
22
- if (project.ignore) {
23
- cmdArgs.push('--ignore-path', project.ignore);
24
- }
25
- if (project.isTs) {
26
- await this.exec('tsc', ['--noEmit']);
27
- }
28
- if (args.files && args.files.startsWith('-')) {
29
- args.files = null;
30
- }
31
- const files = args.files || project.src;
32
- const proc = this.exec(
33
- this.script,
34
- [
35
- files,
36
- '--ext',
37
- ext.join(','),
38
- ...cmdArgs,
39
- ...argv.filter((a) => a !== files),
40
- ],
41
- { env: {}, stdio: 'inherit' }
42
- );
43
- return proc;
44
- }
45
- };
3
+ const command = new DigigovCommand('lint', import.meta.url);
4
+
5
+ command
6
+ .argument('[filter...]', 'Filter files')
7
+ .helpOption(false)
8
+ .allowUnknownOption()
9
+ .action(lint);
10
+
11
+ export default command;
12
+
13
+ /**
14
+ * @param {string[]} args - The arguments
15
+ * @param {DigigovCommand} ctx - The command context
16
+ */
17
+ async function lint(args, _, ctx) {
18
+ await ctx.exec('eslint', ['--no-error-on-unmatched-pattern', ...args], {
19
+ env: {},
20
+ stdio: 'inherit',
21
+ });
22
+ return;
23
+ }
package/package.json CHANGED
@@ -1,42 +1,54 @@
1
1
  {
2
2
  "name": "@digigov/cli-lint",
3
- "version": "1.0.5-rc.21",
3
+ "version": "2.0.0-0c4be34e",
4
4
  "description": "Lint plugin for Digigov CLI",
5
5
  "main": "index.js",
6
+ "type": "module",
6
7
  "author": "GRNET Devs <devs@lists.grnet.gr>",
7
8
  "license": "BSD-2-Clause",
8
9
  "dependencies": {
9
- "@babel/eslint-parser": "7.19.1",
10
- "@oclif/command": "1.8.0",
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
- "execa": "5.0.0",
26
- "@rushstack/eslint-patch": "1.7.2",
12
+ "eslint-plugin-digigov": "2.0.0-0c4be34e",
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",
27
19
  "publint": "0.1.8",
28
- "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"
27
+ },
28
+ "exports": {
29
+ ".": "./index.js",
30
+ "./eslint.config": "./eslint.config.js",
31
+ "./eslintrc": "./eslintrc.cjs",
32
+ "./prettier.config": "./prettier.config.cjs",
33
+ "./prettierrc": "./prettierrc.cjs"
29
34
  },
30
35
  "devDependencies": {
31
36
  "publint": "0.1.8"
32
37
  },
33
38
  "peerDependencies": {
34
- "@digigov/cli": "1.1.1-rc.21",
35
- "@digigov/cli-build": "2.0.0-rc.21",
36
- "prettier": "3.2.5",
37
- "eslint": "8.56.0"
39
+ "@digigov/cli": "2.0.0-0c4be34e",
40
+ "@digigov/cli-build": "2.0.0-0c4be34e",
41
+ "prettier": "^3",
42
+ "typescript": "*",
43
+ "eslint": "^9"
44
+ },
45
+ "peerDependenciesMeta": {
46
+ "typescript": {
47
+ "optional": true
48
+ }
38
49
  },
39
50
  "scripts": {
51
+ "lint": "eslint",
40
52
  "publint": "publint"
41
53
  }
42
54
  }
package/prettierrc.cjs ADDED
@@ -0,0 +1,5 @@
1
+ const { makeConfig } = require('@digigov/cli/lib');
2
+ const prettierrc = (overrides) => {
3
+ return makeConfig(overrides, require('./prettier.config.cjs'));
4
+ };
5
+ module.exports = prettierrc;
package/.eslintrc.js DELETED
@@ -1,2 +0,0 @@
1
- const eslintrc = require('./eslintrc')
2
- module.exports = eslintrc()
package/eslintrc.js DELETED
@@ -1,6 +0,0 @@
1
- const {makeConfig} = require('@digigov/cli/lib')
2
- const eslintrc = (overrides)=>{
3
- return makeConfig(overrides, require('./eslint.common').config)
4
- }
5
- module.exports = eslintrc
6
-
package/prettierrc.js DELETED
@@ -1,6 +0,0 @@
1
- const {makeConfig} = require('@digigov/cli/lib')
2
- const prettierrc = (overrides)=>{
3
- return makeConfig(overrides, require('./prettier.config'))
4
- }
5
- module.exports = prettierrc
6
-
File without changes