@o3r/eslint-config 13.0.0-prerelease.3 → 13.0.0-prerelease.4
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": "13.0.0-prerelease.
|
|
3
|
+
"version": "13.0.0-prerelease.4",
|
|
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": "^13.0.0-prerelease.
|
|
40
|
+
"@o3r/schematics": "^13.0.0-prerelease.4"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@angular-devkit/core": "^20.0.0",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"@angular/compiler": "^20.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": "^13.0.0-prerelease.
|
|
50
|
-
"@o3r/schematics": "^13.0.0-prerelease.
|
|
49
|
+
"@o3r/eslint-plugin": "^13.0.0-prerelease.4",
|
|
50
|
+
"@o3r/schematics": "^13.0.0-prerelease.4",
|
|
51
51
|
"@schematics/angular": "^20.0.0",
|
|
52
52
|
"@stylistic/eslint-plugin": "~5.2.0",
|
|
53
53
|
"@typescript-eslint/parser": "^8.15.0",
|
|
@@ -81,9 +81,9 @@
|
|
|
81
81
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.0",
|
|
82
82
|
"@eslint/js": "~9.34.0",
|
|
83
83
|
"@nx/eslint-plugin": "~21.3.11",
|
|
84
|
-
"@o3r/build-helpers": "^13.0.0-prerelease.
|
|
85
|
-
"@o3r/eslint-plugin": "^13.0.0-prerelease.
|
|
86
|
-
"@o3r/test-helpers": "^13.0.0-prerelease.
|
|
84
|
+
"@o3r/build-helpers": "^13.0.0-prerelease.4",
|
|
85
|
+
"@o3r/eslint-plugin": "^13.0.0-prerelease.4",
|
|
86
|
+
"@o3r/test-helpers": "^13.0.0-prerelease.4",
|
|
87
87
|
"@schematics/angular": "~20.0.0",
|
|
88
88
|
"@stylistic/eslint-plugin": "~5.2.0",
|
|
89
89
|
"@types/jest": "~29.5.2",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,IAAI,EAIV,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,IAAI,EAIV,MAAM,4BAA4B,CAAC;AAcpC,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,UAAU,CAAC;AA+HlB;;;GAGG;AACH,eAAO,MAAM,KAAK,GAAI,SAAS,qBAAqB,SAA2C,CAAC"}
|
|
@@ -67,86 +67,56 @@ const handleOtterEslintErrors = (projectName) => (tree, context) => {
|
|
|
67
67
|
};
|
|
68
68
|
/**
|
|
69
69
|
* Add a harmonize script in package.json
|
|
70
|
+
* @param tree
|
|
71
|
+
* @param context
|
|
70
72
|
*/
|
|
71
|
-
const addHarmonizeScript = () => {
|
|
73
|
+
const addHarmonizeScript = (tree, context) => {
|
|
72
74
|
const rootPackageJsonPath = '/package.json';
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
context.logger.info('A "harmonize" script already exists in the root "package.json". Version harmonize script will not be added.');
|
|
83
|
-
return tree;
|
|
84
|
-
}
|
|
85
|
-
const postInstall = rootPackageJsonObject.scripts.postinstall;
|
|
86
|
-
rootPackageJsonObject.scripts.harmonize = `eslint "**/package.json" ${isYarnPackageManager ? '.yarnrc.yml ' : ''}--quiet --fix --no-error-on-unmatched-pattern`;
|
|
87
|
-
rootPackageJsonObject.scripts.postinstall = `${postInstall ? postInstall + ' && ' : ''}${extraPostInstall}`;
|
|
88
|
-
tree.overwrite(rootPackageJsonPath, JSON.stringify(rootPackageJsonObject, null, 2));
|
|
75
|
+
if (!tree.exists(rootPackageJsonPath)) {
|
|
76
|
+
throw new schematics_1.SchematicsException('Root package.json does not exist');
|
|
77
|
+
}
|
|
78
|
+
const isYarnPackageManager = (0, schematics_2.getPackageManager)() === 'yarn';
|
|
79
|
+
const extraPostInstall = isYarnPackageManager ? 'yarn harmonize && yarn install --mode=skip-build' : 'npm run harmonize && npm install --ignore-scripts';
|
|
80
|
+
const rootPackageJsonObject = tree.readJson(rootPackageJsonPath);
|
|
81
|
+
rootPackageJsonObject.scripts ||= {};
|
|
82
|
+
if (rootPackageJsonObject.scripts.harmonize) {
|
|
83
|
+
context.logger.info('A "harmonize" script already exists in the root "package.json". Version harmonize script will not be added.');
|
|
89
84
|
return tree;
|
|
90
|
-
}
|
|
85
|
+
}
|
|
86
|
+
const postInstall = rootPackageJsonObject.scripts.postinstall;
|
|
87
|
+
rootPackageJsonObject.scripts.harmonize = `eslint "**/package.json" ${isYarnPackageManager ? '.yarnrc.yml ' : ''}--quiet --fix --no-error-on-unmatched-pattern`;
|
|
88
|
+
rootPackageJsonObject.scripts.postinstall = `${postInstall ? postInstall + ' && ' : ''}${extraPostInstall}`;
|
|
89
|
+
tree.overwrite(rootPackageJsonPath, JSON.stringify(rootPackageJsonObject, null, 2));
|
|
90
|
+
return tree;
|
|
91
91
|
};
|
|
92
|
+
const packageJsonPath = path.resolve(__dirname, '..', '..', 'package.json');
|
|
92
93
|
function ngAddFn(options) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
catch { }
|
|
101
|
-
if (installJestPlugin) {
|
|
102
|
-
devDependenciesToInstall.push('eslint-plugin-jest');
|
|
103
|
-
}
|
|
104
|
-
if (options.projectName) {
|
|
105
|
-
devDependenciesToInstall.push('@angular-eslint/builder');
|
|
106
|
-
}
|
|
107
|
-
const depsInfo = (0, schematics_2.getO3rPeerDeps)(path.resolve(__dirname, '..', '..', 'package.json'), true, /^@(?:o3r|ama-sdk)/);
|
|
94
|
+
let installJestPlugin = false;
|
|
95
|
+
try {
|
|
96
|
+
require.resolve('jest');
|
|
97
|
+
installJestPlugin = true;
|
|
98
|
+
}
|
|
99
|
+
catch { }
|
|
100
|
+
const setupConfigAndFixKnownErrors = (tree) => {
|
|
108
101
|
const workspaceProject = options.projectName ? (0, schematics_2.getWorkspaceConfig)(tree)?.projects[options.projectName] : undefined;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}],
|
|
116
|
-
ngAddOptions: { exactO3rVersion: options.exactO3rVersion }
|
|
117
|
-
};
|
|
118
|
-
return acc;
|
|
119
|
-
}, (0, schematics_2.getPackageInstallConfig)(packageJsonPath, tree, options.projectName, true, !!options.exactO3rVersion));
|
|
120
|
-
const projectDirectory = workspaceProject?.root || '.';
|
|
121
|
-
const projectPackageJson = tree.readJson(path.posix.join(projectDirectory, 'package.json'));
|
|
122
|
-
const externalDependenciesInfo = (0, schematics_2.getExternalDependenciesInfo)({
|
|
123
|
-
devDependenciesToInstall,
|
|
124
|
-
dependenciesToInstall,
|
|
125
|
-
projectType: workspaceProject?.projectType,
|
|
126
|
-
projectPackageJson,
|
|
127
|
-
o3rPackageJsonPath: packageJsonPath
|
|
128
|
-
}, context.logger);
|
|
129
|
-
return () => (0, schematics_1.chain)([
|
|
130
|
-
(0, schematics_2.setupDependencies)({
|
|
131
|
-
projectName: options.projectName,
|
|
132
|
-
dependencies: {
|
|
133
|
-
...dependencies,
|
|
134
|
-
...externalDependenciesInfo
|
|
135
|
-
},
|
|
136
|
-
ngAddToRun: depsInfo.o3rPeerDeps
|
|
137
|
-
}),
|
|
138
|
-
index_2.updateVscode,
|
|
139
|
-
(0, index_1.updateEslintConfig)(__dirname),
|
|
140
|
-
addHarmonizeScript(),
|
|
141
|
-
options.projectName && workspaceProject?.root
|
|
142
|
-
? (0, schematics_1.chain)([
|
|
143
|
-
(0, index_1.updateEslintConfig)(__dirname, options.projectName),
|
|
144
|
-
options.fix ? handleOtterEslintErrors(options.projectName) : (0, schematics_1.noop)()
|
|
145
|
-
])
|
|
146
|
-
: (0, schematics_1.noop)(),
|
|
147
|
-
options.skipLinter ? (0, schematics_1.noop)() : (0, schematics_2.applyEditorConfig)()
|
|
148
|
-
])(tree, context);
|
|
102
|
+
return options.projectName && workspaceProject?.root
|
|
103
|
+
? (0, schematics_1.chain)([
|
|
104
|
+
(0, index_1.updateEslintConfig)(__dirname, options.projectName),
|
|
105
|
+
options.fix ? handleOtterEslintErrors(options.projectName) : (0, schematics_1.noop)()
|
|
106
|
+
])
|
|
107
|
+
: (0, schematics_1.noop)();
|
|
149
108
|
};
|
|
109
|
+
return (0, schematics_1.chain)([
|
|
110
|
+
(0, schematics_2.ngAddDependenciesRule)(options, packageJsonPath, {
|
|
111
|
+
dependenciesToInstall,
|
|
112
|
+
devDependenciesToInstall: devDependenciesToInstall.concat(installJestPlugin ? ['eslint-plugin-jest'] : [], options.projectName ? ['@angular-eslint/builder'] : [])
|
|
113
|
+
}),
|
|
114
|
+
index_2.updateVscode,
|
|
115
|
+
(0, index_1.updateEslintConfig)(__dirname),
|
|
116
|
+
addHarmonizeScript,
|
|
117
|
+
setupConfigAndFixKnownErrors,
|
|
118
|
+
options.skipLinter ? (0, schematics_1.noop)() : (0, schematics_2.applyEditorConfig)()
|
|
119
|
+
]);
|
|
150
120
|
}
|
|
151
121
|
/**
|
|
152
122
|
* Add Otter eslint-config to an Angular Project
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import type { SchematicOptionObject } from '@o3r/schematics';
|
|
2
|
-
export interface NgAddSchematicsSchema extends SchematicOptionObject {
|
|
3
|
-
/** Project name */
|
|
4
|
-
projectName?: string | undefined;
|
|
5
|
-
/** Use a pinned version for otter packages */
|
|
6
|
-
exactO3rVersion?: boolean;
|
|
1
|
+
import type { NgAddOptions, SchematicOptionObject } from '@o3r/schematics';
|
|
2
|
+
export interface NgAddSchematicsSchema extends NgAddOptions, SchematicOptionObject {
|
|
7
3
|
/** Fix known issues with our ESLint config after Otter application or library generation */
|
|
8
4
|
fix?: boolean;
|
|
9
5
|
/** Skip the linter process which includes EditorConfig rules applying */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,qBAAsB,SAAQ,
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,qBAAsB,SAAQ,YAAY,EAAE,qBAAqB;IAChF,4FAA4F;IAC5F,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,yEAAyE;IACzE,UAAU,EAAE,OAAO,CAAC;CACrB"}
|