@digigov/cli-lint 1.0.5-rc.21 → 2.0.0-6452adf3

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/.eslintrc.cjs ADDED
@@ -0,0 +1,3 @@
1
+ const eslintrc = require('./eslint.common.cjs').config;
2
+
3
+ module.exports = eslintrc;
@@ -1,16 +1,15 @@
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!",
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!",
5
4
  "/@rushstack/eslint-patch@1.7.2": "Missing shrinkwrap entry!",
6
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!",
7
6
  "/@typescript-eslint/parser@6.19.1(eslint@8.56.0)(typescript@5.6.2)": "Missing shrinkwrap entry!",
8
7
  "/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!",
8
+ "/eslint-import-resolver-babel-module@5.3.2(@babel/core@7.26.0)(babel-plugin-module-resolver@4.0.0)": "Missing shrinkwrap entry!",
10
9
  "/eslint-plugin-css-modules@2.12.0(eslint@8.56.0)": "Missing shrinkwrap entry!",
11
10
  "/eslint-plugin-enzyme@0.2.0(eslint@8.56.0)": "Missing shrinkwrap entry!",
12
11
  "/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!",
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!",
14
13
  "/eslint-plugin-json@3.1.0": "Missing shrinkwrap entry!",
15
14
  "/eslint-plugin-mdx@2.3.4(eslint@8.56.0)": "Missing shrinkwrap entry!",
16
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!",
@@ -18,7 +17,7 @@
18
17
  "/eslint-plugin-react-hooks@4.6.0(eslint@8.56.0)": "Missing shrinkwrap entry!",
19
18
  "/eslint-plugin-react@7.33.2(eslint@8.56.0)": "Missing shrinkwrap entry!",
20
19
  "/eslint@8.56.0": "Missing shrinkwrap entry!",
21
- "/execa@5.0.0": "Missing shrinkwrap entry!",
22
20
  "/prettier@3.2.5": "Missing shrinkwrap entry!",
23
- "/publint@0.1.8": "Missing shrinkwrap entry!"
21
+ "/publint@0.1.8": "Missing shrinkwrap entry!",
22
+ "/typescript@5.6.2": "Missing shrinkwrap entry!"
24
23
  }
@@ -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
  };
@@ -0,0 +1 @@
1
+ module.exports = require('./eslintrc.cjs')();
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,53 @@
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');
5
-
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' }
1
+ import { DigigovCommand, resolveProject } from '@digigov/cli/lib';
2
+ import fs from 'fs';
3
+ import path from 'path';
4
+
5
+ const command = new DigigovCommand('lint', import.meta.url);
6
+
7
+ const FILE_EXTENSIONS = ['.js', '.jsx', '.json', '.ts', '.tsx', '.mdx'];
8
+
9
+ command
10
+ .argument('[filter...]', 'Filter files')
11
+ .helpOption(false)
12
+ .allowUnknownOption()
13
+ .action(lint);
14
+
15
+ export default command;
16
+
17
+ /**
18
+ * @param {string[]} args - The arguments
19
+ * @param {DigigovCommand} ctx - The command context
20
+ */
21
+ 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'
42
30
  );
43
- return proc;
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);
44
40
  }
45
- };
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
+ );
52
+ return;
53
+ }
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@digigov/cli-lint",
3
- "version": "1.0.5-rc.21",
3
+ "version": "2.0.0-6452adf3",
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
10
  "@babel/eslint-parser": "7.19.1",
10
- "@oclif/command": "1.8.0",
11
11
  "@typescript-eslint/eslint-plugin": "6.19.1",
12
12
  "@typescript-eslint/parser": "6.19.1",
13
13
  "eslint-config-prettier": "9.1.0",
@@ -22,21 +22,35 @@
22
22
  "eslint-plugin-promise": "6.1.1",
23
23
  "eslint-plugin-react": "7.33.2",
24
24
  "eslint-plugin-react-hooks": "4.6.0",
25
- "execa": "5.0.0",
26
25
  "@rushstack/eslint-patch": "1.7.2",
27
26
  "publint": "0.1.8",
28
27
  "eslint-plugin-digigov": "1.0.0"
29
28
  },
29
+ "exports": {
30
+ ".": "./index.js",
31
+ "./eslint.common": "./eslint.common.cjs",
32
+ "./eslint.config": "./eslint.config.cjs",
33
+ "./eslintrc": "./eslintrc.cjs",
34
+ "./prettier.config": "./prettier.config.cjs",
35
+ "./prettierrc": "./prettierrc.cjs"
36
+ },
30
37
  "devDependencies": {
31
38
  "publint": "0.1.8"
32
39
  },
33
40
  "peerDependencies": {
34
- "@digigov/cli": "1.1.1-rc.21",
35
- "@digigov/cli-build": "2.0.0-rc.21",
41
+ "@digigov/cli": "2.0.0-6452adf3",
42
+ "@digigov/cli-build": "2.0.0-6452adf3",
36
43
  "prettier": "3.2.5",
44
+ "typescript": "*",
37
45
  "eslint": "8.56.0"
38
46
  },
47
+ "peerDependenciesMeta": {
48
+ "typescript": {
49
+ "optional": true
50
+ }
51
+ },
39
52
  "scripts": {
53
+ "lint": "eslint --ext .js .",
40
54
  "publint": "publint"
41
55
  }
42
56
  }
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/eslint.config.js DELETED
@@ -1 +0,0 @@
1
- module.exports = require('./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