@o3r/eslint-config 12.3.0-prerelease.55 → 12.3.0-prerelease.56

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o3r/eslint-config",
3
- "version": "12.3.0-prerelease.55",
3
+ "version": "12.3.0-prerelease.56",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -37,7 +37,7 @@
37
37
  "build:builders": "tsc -b tsconfig.builders.json --pretty && yarn generate-cjs-manifest"
38
38
  },
39
39
  "dependencies": {
40
- "@o3r/schematics": "^12.3.0-prerelease.55"
40
+ "@o3r/schematics": "^12.3.0-prerelease.56"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@angular-devkit/core": "^19.0.0",
@@ -46,8 +46,8 @@
46
46
  "@angular/compiler": "^19.0.0",
47
47
  "@eslint-community/eslint-plugin-eslint-comments": "^4.4.0",
48
48
  "@eslint/js": "^8.57.0 || ^9.22.0",
49
- "@o3r/eslint-plugin": "^12.3.0-prerelease.55",
50
- "@o3r/schematics": "^12.3.0-prerelease.55",
49
+ "@o3r/eslint-plugin": "^12.3.0-prerelease.56",
50
+ "@o3r/schematics": "^12.3.0-prerelease.56",
51
51
  "@schematics/angular": "^19.0.0",
52
52
  "@stylistic/eslint-plugin": "~3.1.0",
53
53
  "@typescript-eslint/parser": "^8.15.0",
@@ -79,9 +79,9 @@
79
79
  "@eslint-community/eslint-plugin-eslint-comments": "^4.4.0",
80
80
  "@eslint/js": "~9.25.0",
81
81
  "@nx/eslint-plugin": "~20.8.0",
82
- "@o3r/build-helpers": "^12.3.0-prerelease.55",
83
- "@o3r/eslint-plugin": "^12.3.0-prerelease.55",
84
- "@o3r/test-helpers": "^12.3.0-prerelease.55",
82
+ "@o3r/build-helpers": "^12.3.0-prerelease.56",
83
+ "@o3r/eslint-plugin": "^12.3.0-prerelease.56",
84
+ "@o3r/test-helpers": "^12.3.0-prerelease.56",
85
85
  "@schematics/angular": "~19.2.0",
86
86
  "@stylistic/eslint-plugin": "~3.1.0",
87
87
  "@types/eslint__js": "^8.42.3",
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/ng-add/eslint/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAQL,KAAK,IAAI,EAGV,MAAM,4BAA4B,CAAC;AAqCpC;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAU,MAAM,EAAE,cAAc,MAAM,KAAG,IA4D3E,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/ng-add/eslint/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAQL,KAAK,IAAI,EAGV,MAAM,4BAA4B,CAAC;AAyCpC;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAU,MAAM,EAAE,cAAc,MAAM,KAAG,IA2D3E,CAAC"}
@@ -4,12 +4,12 @@ exports.updateEslintConfig = void 0;
4
4
  const path = require("node:path");
5
5
  const core_1 = require("@angular-devkit/core");
6
6
  const schematics_1 = require("@angular-devkit/schematics");
7
+ const schematics_2 = require("@o3r/schematics");
7
8
  const index_1 = require("../tsconfig/index");
8
- const editAngularJson = (projectName, extension) => async (tree, context) => {
9
+ const editAngularJson = (projectName, extension) => (tree, context) => {
9
10
  let workspace = null;
10
11
  try {
11
- const { getWorkspaceConfig } = await Promise.resolve().then(() => require('@o3r/schematics'));
12
- workspace = getWorkspaceConfig(tree);
12
+ workspace = (0, schematics_2.getWorkspaceConfig)(tree);
13
13
  }
14
14
  catch {
15
15
  context.logger.warn(`No @o3r/schematics installed, we could not detect the workspace. The linter task for ${projectName} can not be added.`);
@@ -37,13 +37,12 @@ const editAngularJson = (projectName, extension) => async (tree, context) => {
37
37
  * @param rootPath
38
38
  * @param projectName
39
39
  */
40
- const updateEslintConfig = (rootPath, projectName) => async (tree, context) => {
41
- const { findFilesInTree, getTemplateFolder, getWorkspaceConfig } = await Promise.resolve().then(() => require('@o3r/schematics'));
42
- const workspace = getWorkspaceConfig(tree);
40
+ const updateEslintConfig = (rootPath, projectName) => (tree, context) => {
41
+ const workspace = (0, schematics_2.getWorkspaceConfig)(tree);
43
42
  const workspaceProject = workspace?.projects[projectName || ''];
44
43
  const projectRootPath = workspaceProject?.root || '.';
45
44
  const workingDir = tree.getDir(projectRootPath);
46
- const eslintConfigFiles = findFilesInTree(workingDir, (file) => /eslint.config.[cm]?js/.test(file));
45
+ const eslintConfigFiles = (0, schematics_2.findFilesInTree)(workingDir, (file) => /eslint.config.[cm]?js/.test(file));
47
46
  if (eslintConfigFiles.length > 1) {
48
47
  context.logger.warn('Unable to add the "@o3r/eslint-config" recommendation because several ESLint config file detected.\n'
49
48
  + eslintConfigFiles.map((file) => `\t- ${file.path.toString()}`).join('\n'));
@@ -56,7 +55,7 @@ const updateEslintConfig = (rootPath, projectName) => async (tree, context) => {
56
55
  oldConfig: '',
57
56
  relativePathToRoot: path.posix.relative(projectRootPath, '.'),
58
57
  packageName: tree.readJson(workingDir.file((0, core_1.fragment)('package.json'))?.path || 'package.json').name,
59
- detectedTsConfigs: findFilesInTree(workingDir, (f) => /tsconfig\..*\.json/.test(f)).map((entry) => path.basename(entry.path)).concat('tsconfig.eslint.json'),
58
+ detectedTsConfigs: (0, schematics_2.findFilesInTree)(workingDir, (f) => /tsconfig\..*\.json/.test(f)).map((entry) => path.basename(entry.path)).concat('tsconfig.eslint.json'),
60
59
  isApp: workspaceProject?.projectType === 'application'
61
60
  };
62
61
  if (eslintConfigFiles.length === 1) {
@@ -81,7 +80,7 @@ const updateEslintConfig = (rootPath, projectName) => async (tree, context) => {
81
80
  projectName ? editAngularJson(projectName, templateOptions.extension) : (0, schematics_1.noop)(),
82
81
  (0, schematics_1.applyToSubtree)(projectRootPath, [
83
82
  (0, index_1.updateOrAddTsconfigEslint)(rootPath),
84
- (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)(getTemplateFolder(rootPath, __dirname, `./templates/${projectRootPath === '.' ? 'workspace' : 'project'}`)), [
83
+ (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)((0, schematics_2.getTemplateFolder)(rootPath, __dirname, `./templates/${projectRootPath === '.' ? 'workspace' : 'project'}`)), [
85
84
  (0, schematics_1.template)(templateOptions),
86
85
  (0, schematics_1.renameTemplateFiles)()
87
86
  ]), schematics_1.MergeStrategy.Overwrite)
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,IAAI,EAGV,MAAM,4BAA4B,CAAC;AAOpC,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAiIlB;;;GAGG;AACH,eAAO,MAAM,KAAK,GAAI,SAAS,qBAAqB,KAAG,IAKtD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,IAAI,EAGV,MAAM,4BAA4B,CAAC;AAcpC,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAkHlB;;;GAGG;AACH,eAAO,MAAM,KAAK,GAAI,SAAS,qBAAqB,SAA2C,CAAC"}
@@ -6,17 +6,11 @@ const schematics_1 = require("@angular-devkit/schematics");
6
6
  const schematics_2 = require("@o3r/schematics");
7
7
  const index_1 = require("./eslint/index");
8
8
  const index_2 = require("./vscode/index");
9
- const reportMissingSchematicsDep = (logger) => (reason) => {
10
- logger.error(`[ERROR]: Adding @o3r/eslint-config has failed.
11
- You need to install '@o3r/schematics' package to be able to use the eslint-config package. Please run 'ng add @o3r/schematics' .`);
12
- throw reason;
13
- };
14
- const handleOtterEslintErrors = (projectName) => async (tree, context) => {
9
+ const handleOtterEslintErrors = (projectName) => (tree, context) => {
15
10
  if (!projectName) {
16
11
  return;
17
12
  }
18
- const { getWorkspaceConfig } = await Promise.resolve().then(() => require('@o3r/schematics'));
19
- const workspace = getWorkspaceConfig(tree);
13
+ const workspace = (0, schematics_2.getWorkspaceConfig)(tree);
20
14
  if (!workspace) {
21
15
  return;
22
16
  }
@@ -75,22 +69,21 @@ function ngAddFn(options) {
75
69
  'yaml-eslint-parser',
76
70
  ...(options.projectName ? ['@angular-eslint/builder'] : [])
77
71
  ];
78
- const { getExternalDependenciesVersionRange, setupDependencies, getWorkspaceConfig, getO3rPeerDeps, getProjectNewDependenciesTypes, getPackageInstallConfig } = await Promise.resolve().then(() => require('@o3r/schematics'));
79
- const depsInfo = getO3rPeerDeps(path.resolve(__dirname, '..', '..', 'package.json'), true, /^@(?:o3r|ama-sdk)/);
80
- const workspaceProject = options.projectName ? getWorkspaceConfig(tree)?.projects[options.projectName] : undefined;
72
+ const depsInfo = (0, schematics_2.getO3rPeerDeps)(path.resolve(__dirname, '..', '..', 'package.json'), true, /^@(?:o3r|ama-sdk)/);
73
+ const workspaceProject = options.projectName ? (0, schematics_2.getWorkspaceConfig)(tree)?.projects[options.projectName] : undefined;
81
74
  const { NodeDependencyType } = await Promise.resolve().then(() => require('@schematics/angular/utility/dependencies'));
82
75
  const packageJsonPath = path.resolve(__dirname, '..', '..', 'package.json');
83
76
  const dependencies = depsInfo.o3rPeerDeps.reduce((acc, dep) => {
84
77
  acc[dep] = {
85
78
  inManifest: [{
86
79
  range: `${options.exactO3rVersion ? '' : '~'}${depsInfo.packageVersion}`,
87
- types: getProjectNewDependenciesTypes(workspaceProject)
80
+ types: (0, schematics_2.getProjectNewDependenciesTypes)(workspaceProject)
88
81
  }],
89
82
  ngAddOptions: { exactO3rVersion: options.exactO3rVersion }
90
83
  };
91
84
  return acc;
92
- }, getPackageInstallConfig(packageJsonPath, tree, options.projectName, true, !!options.exactO3rVersion));
93
- Object.entries(getExternalDependenciesVersionRange(devDependenciesToInstall, packageJsonPath, context.logger))
85
+ }, (0, schematics_2.getPackageInstallConfig)(packageJsonPath, tree, options.projectName, true, !!options.exactO3rVersion));
86
+ Object.entries((0, schematics_2.getExternalDependenciesVersionRange)(devDependenciesToInstall, packageJsonPath, context.logger))
94
87
  .forEach(([dep, range]) => {
95
88
  dependencies[dep] = {
96
89
  inManifest: [{
@@ -100,7 +93,7 @@ function ngAddFn(options) {
100
93
  };
101
94
  });
102
95
  return () => (0, schematics_1.chain)([
103
- setupDependencies({
96
+ (0, schematics_2.setupDependencies)({
104
97
  projectName: options.projectName,
105
98
  dependencies,
106
99
  ngAddToRun: depsInfo.o3rPeerDeps
@@ -121,9 +114,6 @@ function ngAddFn(options) {
121
114
  * Add Otter eslint-config to an Angular Project
122
115
  * @param options Options for the schematic
123
116
  */
124
- const ngAdd = (options) => async (_, { logger }) => {
125
- const { createOtterSchematic } = await Promise.resolve().then(() => require('@o3r/schematics')).catch(reportMissingSchematicsDep(logger));
126
- return createOtterSchematic(ngAddFn)(options);
127
- };
117
+ const ngAdd = (options) => (0, schematics_2.createOtterSchematic)(ngAddFn)(options);
128
118
  exports.ngAdd = ngAdd;
129
119
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/ng-add/tsconfig/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAKL,KAAK,IAAI,EAGV,MAAM,4BAA4B,CAAC;AAEpC;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,GAAI,UAAU,MAAM,EAAE,wBAA4B,KAAG,IAa1F,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/ng-add/tsconfig/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAKL,KAAK,IAAI,EAGV,MAAM,4BAA4B,CAAC;AAIpC;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,GAAI,UAAU,MAAM,EAAE,wBAA4B,KAAG,IAa1F,CAAC"}
@@ -2,12 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateOrAddTsconfigEslint = void 0;
4
4
  const schematics_1 = require("@angular-devkit/schematics");
5
+ const schematics_2 = require("@o3r/schematics");
5
6
  /**
6
7
  * Update or add tsconfig.eslint.json file
7
8
  * @param rootPath
8
9
  * @param projectTsConfig
9
10
  */
10
- const updateOrAddTsconfigEslint = (rootPath, projectTsConfig = 'tsconfig') => async (tree) => {
11
+ const updateOrAddTsconfigEslint = (rootPath, projectTsConfig = 'tsconfig') => (tree) => {
11
12
  const tsconfigPath = 'tsconfig.eslint.json';
12
13
  if (tree.exists(tsconfigPath)) {
13
14
  const tsconfig = tree.readJson(tsconfigPath);
@@ -15,8 +16,7 @@ const updateOrAddTsconfigEslint = (rootPath, projectTsConfig = 'tsconfig') => as
15
16
  tree.overwrite(tsconfigPath, JSON.stringify(tsconfig, null, 2));
16
17
  return () => tree;
17
18
  }
18
- const { getTemplateFolder } = await Promise.resolve().then(() => require('@o3r/schematics'));
19
- return () => (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)(getTemplateFolder(rootPath, __dirname)), [
19
+ return () => (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)((0, schematics_2.getTemplateFolder)(rootPath, __dirname)), [
20
20
  (0, schematics_1.template)({ projectTsConfig }),
21
21
  (0, schematics_1.renameTemplateFiles)()
22
22
  ]), schematics_1.MergeStrategy.Overwrite);
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/ng-add/vscode/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,IAAI,EACV,MAAM,4BAA4B,CAAC;AAoCpC;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,IAwB1B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/ng-add/vscode/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,IAAI,EACV,MAAM,4BAA4B,CAAC;AAuCpC;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,IAuB1B,CAAC"}
@@ -2,13 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateVscode = void 0;
4
4
  const schematics_1 = require("@angular-devkit/schematics");
5
+ const schematics_2 = require("@o3r/schematics");
5
6
  /**
6
7
  * Update VSCode recommendations and settings
7
8
  */
8
- const updateVscode = async () => {
9
- const { addVsCodeRecommendations } = await Promise.resolve().then(() => require('@o3r/schematics'));
9
+ const updateVscode = () => {
10
10
  return (0, schematics_1.chain)([
11
- addVsCodeRecommendations(['dbaeumer.vscode-eslint']),
11
+ (0, schematics_2.addVsCodeRecommendations)(['dbaeumer.vscode-eslint']),
12
12
  (tree) => {
13
13
  const vscodeSettingsPath = '.vscode/settings.json';
14
14
  const settings = (tree.exists(vscodeSettingsPath) ? (tree.readJson(vscodeSettingsPath) || {}) : {});