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

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.53",
3
+ "version": "12.3.0-prerelease.55",
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.53"
40
+ "@o3r/schematics": "^12.3.0-prerelease.55"
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.53",
50
- "@o3r/schematics": "^12.3.0-prerelease.53",
49
+ "@o3r/eslint-plugin": "^12.3.0-prerelease.55",
50
+ "@o3r/schematics": "^12.3.0-prerelease.55",
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.53",
83
- "@o3r/eslint-plugin": "^12.3.0-prerelease.53",
84
- "@o3r/test-helpers": "^12.3.0-prerelease.53",
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",
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;AAyCpC;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAU,MAAM,EAAE,cAAc,MAAM,KAAG,IA2D3E,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;AAqCpC;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAU,MAAM,EAAE,cAAc,MAAM,KAAG,IA4D3E,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");
8
7
  const index_1 = require("../tsconfig/index");
9
- const editAngularJson = (projectName, extension) => (tree, context) => {
8
+ const editAngularJson = (projectName, extension) => async (tree, context) => {
10
9
  let workspace = null;
11
10
  try {
12
- workspace = (0, schematics_2.getWorkspaceConfig)(tree);
11
+ const { getWorkspaceConfig } = await Promise.resolve().then(() => require('@o3r/schematics'));
12
+ workspace = 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,12 +37,13 @@ const editAngularJson = (projectName, extension) => (tree, context) => {
37
37
  * @param rootPath
38
38
  * @param projectName
39
39
  */
40
- const updateEslintConfig = (rootPath, projectName) => (tree, context) => {
41
- const workspace = (0, schematics_2.getWorkspaceConfig)(tree);
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);
42
43
  const workspaceProject = workspace?.projects[projectName || ''];
43
44
  const projectRootPath = workspaceProject?.root || '.';
44
45
  const workingDir = tree.getDir(projectRootPath);
45
- const eslintConfigFiles = (0, schematics_2.findFilesInTree)(workingDir, (file) => /eslint.config.[cm]?js/.test(file));
46
+ const eslintConfigFiles = findFilesInTree(workingDir, (file) => /eslint.config.[cm]?js/.test(file));
46
47
  if (eslintConfigFiles.length > 1) {
47
48
  context.logger.warn('Unable to add the "@o3r/eslint-config" recommendation because several ESLint config file detected.\n'
48
49
  + eslintConfigFiles.map((file) => `\t- ${file.path.toString()}`).join('\n'));
@@ -55,7 +56,7 @@ const updateEslintConfig = (rootPath, projectName) => (tree, context) => {
55
56
  oldConfig: '',
56
57
  relativePathToRoot: path.posix.relative(projectRootPath, '.'),
57
58
  packageName: tree.readJson(workingDir.file((0, core_1.fragment)('package.json'))?.path || 'package.json').name,
58
- detectedTsConfigs: (0, schematics_2.findFilesInTree)(workingDir, (f) => /tsconfig\..*\.json/.test(f)).map((entry) => path.basename(entry.path)).concat('tsconfig.eslint.json'),
59
+ detectedTsConfigs: findFilesInTree(workingDir, (f) => /tsconfig\..*\.json/.test(f)).map((entry) => path.basename(entry.path)).concat('tsconfig.eslint.json'),
59
60
  isApp: workspaceProject?.projectType === 'application'
60
61
  };
61
62
  if (eslintConfigFiles.length === 1) {
@@ -80,7 +81,7 @@ const updateEslintConfig = (rootPath, projectName) => (tree, context) => {
80
81
  projectName ? editAngularJson(projectName, templateOptions.extension) : (0, schematics_1.noop)(),
81
82
  (0, schematics_1.applyToSubtree)(projectRootPath, [
82
83
  (0, index_1.updateOrAddTsconfigEslint)(rootPath),
83
- (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)((0, schematics_2.getTemplateFolder)(rootPath, __dirname, `./templates/${projectRootPath === '.' ? 'workspace' : 'project'}`)), [
84
+ (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)(getTemplateFolder(rootPath, __dirname, `./templates/${projectRootPath === '.' ? 'workspace' : 'project'}`)), [
84
85
  (0, schematics_1.template)(templateOptions),
85
86
  (0, schematics_1.renameTemplateFiles)()
86
87
  ]), 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;AAcpC,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAkHlB;;;GAGG;AACH,eAAO,MAAM,KAAK,GAAI,SAAS,qBAAqB,SAA2C,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;AAOpC,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAiIlB;;;GAGG;AACH,eAAO,MAAM,KAAK,GAAI,SAAS,qBAAqB,KAAG,IAKtD,CAAC"}
@@ -6,11 +6,17 @@ 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 handleOtterEslintErrors = (projectName) => (tree, context) => {
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) => {
10
15
  if (!projectName) {
11
16
  return;
12
17
  }
13
- const workspace = (0, schematics_2.getWorkspaceConfig)(tree);
18
+ const { getWorkspaceConfig } = await Promise.resolve().then(() => require('@o3r/schematics'));
19
+ const workspace = getWorkspaceConfig(tree);
14
20
  if (!workspace) {
15
21
  return;
16
22
  }
@@ -69,21 +75,22 @@ function ngAddFn(options) {
69
75
  'yaml-eslint-parser',
70
76
  ...(options.projectName ? ['@angular-eslint/builder'] : [])
71
77
  ];
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;
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;
74
81
  const { NodeDependencyType } = await Promise.resolve().then(() => require('@schematics/angular/utility/dependencies'));
75
82
  const packageJsonPath = path.resolve(__dirname, '..', '..', 'package.json');
76
83
  const dependencies = depsInfo.o3rPeerDeps.reduce((acc, dep) => {
77
84
  acc[dep] = {
78
85
  inManifest: [{
79
86
  range: `${options.exactO3rVersion ? '' : '~'}${depsInfo.packageVersion}`,
80
- types: (0, schematics_2.getProjectNewDependenciesTypes)(workspaceProject)
87
+ types: getProjectNewDependenciesTypes(workspaceProject)
81
88
  }],
82
89
  ngAddOptions: { exactO3rVersion: options.exactO3rVersion }
83
90
  };
84
91
  return acc;
85
- }, (0, schematics_2.getPackageInstallConfig)(packageJsonPath, tree, options.projectName, true, !!options.exactO3rVersion));
86
- Object.entries((0, schematics_2.getExternalDependenciesVersionRange)(devDependenciesToInstall, packageJsonPath, context.logger))
92
+ }, getPackageInstallConfig(packageJsonPath, tree, options.projectName, true, !!options.exactO3rVersion));
93
+ Object.entries(getExternalDependenciesVersionRange(devDependenciesToInstall, packageJsonPath, context.logger))
87
94
  .forEach(([dep, range]) => {
88
95
  dependencies[dep] = {
89
96
  inManifest: [{
@@ -93,7 +100,7 @@ function ngAddFn(options) {
93
100
  };
94
101
  });
95
102
  return () => (0, schematics_1.chain)([
96
- (0, schematics_2.setupDependencies)({
103
+ setupDependencies({
97
104
  projectName: options.projectName,
98
105
  dependencies,
99
106
  ngAddToRun: depsInfo.o3rPeerDeps
@@ -114,6 +121,9 @@ function ngAddFn(options) {
114
121
  * Add Otter eslint-config to an Angular Project
115
122
  * @param options Options for the schematic
116
123
  */
117
- const ngAdd = (options) => (0, schematics_2.createOtterSchematic)(ngAddFn)(options);
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
+ };
118
128
  exports.ngAdd = ngAdd;
119
129
  //# 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;AAIpC;;;;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;AAEpC;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,GAAI,UAAU,MAAM,EAAE,wBAA4B,KAAG,IAa1F,CAAC"}
@@ -2,13 +2,12 @@
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");
6
5
  /**
7
6
  * Update or add tsconfig.eslint.json file
8
7
  * @param rootPath
9
8
  * @param projectTsConfig
10
9
  */
11
- const updateOrAddTsconfigEslint = (rootPath, projectTsConfig = 'tsconfig') => (tree) => {
10
+ const updateOrAddTsconfigEslint = (rootPath, projectTsConfig = 'tsconfig') => async (tree) => {
12
11
  const tsconfigPath = 'tsconfig.eslint.json';
13
12
  if (tree.exists(tsconfigPath)) {
14
13
  const tsconfig = tree.readJson(tsconfigPath);
@@ -16,7 +15,8 @@ const updateOrAddTsconfigEslint = (rootPath, projectTsConfig = 'tsconfig') => (t
16
15
  tree.overwrite(tsconfigPath, JSON.stringify(tsconfig, null, 2));
17
16
  return () => tree;
18
17
  }
19
- return () => (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)((0, schematics_2.getTemplateFolder)(rootPath, __dirname)), [
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)), [
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;AAuCpC;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,IAuB1B,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;AAoCpC;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,IAwB1B,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");
6
5
  /**
7
6
  * Update VSCode recommendations and settings
8
7
  */
9
- const updateVscode = () => {
8
+ const updateVscode = async () => {
9
+ const { addVsCodeRecommendations } = await Promise.resolve().then(() => require('@o3r/schematics'));
10
10
  return (0, schematics_1.chain)([
11
- (0, schematics_2.addVsCodeRecommendations)(['dbaeumer.vscode-eslint']),
11
+ addVsCodeRecommendations(['dbaeumer.vscode-eslint']),
12
12
  (tree) => {
13
13
  const vscodeSettingsPath = '.vscode/settings.json';
14
14
  const settings = (tree.exists(vscodeSettingsPath) ? (tree.readJson(vscodeSettingsPath) || {}) : {});