@ama-styling/stylelint-plugin 12.5.0-prerelease.10

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/LICENSE ADDED
@@ -0,0 +1,26 @@
1
+ Copyright Amadeus SAS
2
+
3
+ Redistribution and use in source and binary forms, with or without modification,
4
+ are permitted provided that the following conditions are met:
5
+
6
+ 1. Redistributions of source code must retain the above copyright notice, this
7
+ list of conditions and the following disclaimer.
8
+
9
+ 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation and/or
11
+ other materials provided with the distribution.
12
+
13
+ 3. Neither the name of the copyright holder nor the names of its contributors
14
+ may be used to endorse or promote products derived from this software without
15
+ specific prior written permission.
16
+
17
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
21
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,28 @@
1
+ <h1 align="center">Otter stylelint plugin</h1>
2
+ <p align="center">
3
+ <img src="https://raw.githubusercontent.com/AmadeusITGroup/otter/main/assets/logo/otter.png" alt="Super cute Otter!" width="40%"/>
4
+ </p>
5
+
6
+ This package is an [Otter Framework Module](https://github.com/AmadeusITGroup/otter/tree/main/docs/core/MODULE.md).
7
+ <br />
8
+ <br />
9
+
10
+ ## Description
11
+
12
+ [![Stable Version](https://img.shields.io/npm/v/@ama-styling/stylelint-plugin?style=for-the-badge)](https://www.npmjs.com/package/@ama-styling/stylelint-plugin)
13
+ [![Bundle Size](https://img.shields.io/bundlephobia/min/@ama-styling/stylelint-plugin?color=green&style=for-the-badge)](https://www.npmjs.com/package/@ama-styling/stylelint-plugin)
14
+
15
+ In-house stylint plugins to use in your own eslint configuration
16
+
17
+ ## How to install
18
+
19
+ ```shell
20
+ ng add @ama-styling/stylelint-plugin
21
+ ```
22
+
23
+ > [!WARNING]
24
+ > This module requires [@o3r/core](https://www.npmjs.com/package/@o3r/core) to be installed.
25
+
26
+ ## Rules
27
+
28
+ The list of rules is available in the [documentation](https://github.com/AmadeusITGroup/otter/tree/main/docs/linter/stylelint-plugin/rules.md).
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/angular/angular-cli/main/packages/angular_devkit/schematics/collection-schema.json",
3
+ "schematics": {
4
+ "ng-add": {
5
+ "description": "Add Otter stylelint-plugin to the project.",
6
+ "factory": "./schematics/ng-add/index#ngAdd",
7
+ "schema": "./schematics/ng-add/schema.json",
8
+ "aliases": ["install", "i"]
9
+ }
10
+ }
11
+ }
package/package.json ADDED
@@ -0,0 +1,172 @@
1
+ {
2
+ "name": "@ama-styling/stylelint-plugin",
3
+ "version": "12.5.0-prerelease.10",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "description": "In-house stylelint plugin to use in your own eslint configuration",
8
+ "keywords": [
9
+ "stylelint",
10
+ "stylelint-plugin",
11
+ "otter",
12
+ "amadeus",
13
+ "linter",
14
+ "otter-module"
15
+ ],
16
+ "scripts": {
17
+ "nx": "nx",
18
+ "ng": "yarn nx",
19
+ "build": "yarn nx build stylelint-plugin",
20
+ "build:source": "tsc -b tsconfig.build.json",
21
+ "postbuild": "cpy package.json dist/ && patch-package-json-main",
22
+ "prepare:build:builders": "yarn cpy 'schematics/**/*.json' 'schematics/**/templates/**' dist/schematics && yarn cpy './collection.json' dist",
23
+ "build:builders": "tsc -b tsconfig.builders.json --pretty && yarn generate-cjs-manifest"
24
+ },
25
+ "dependencies": {
26
+ "@o3r/schematics": "^12.5.0-prerelease.10",
27
+ "ts-node": "~10.9.2",
28
+ "tslib": "^2.6.2"
29
+ },
30
+ "peerDependencies": {
31
+ "@angular-devkit/schematics": "^19.0.0",
32
+ "@o3r/schematics": "^12.5.0-prerelease.10",
33
+ "@schematics/angular": "^19.0.0",
34
+ "postcss": "^8.4.5",
35
+ "postcss-scss": "^4.0.9",
36
+ "stylelint": "^16.0.2"
37
+ },
38
+ "peerDependenciesMeta": {
39
+ "@angular-devkit/schematics": {
40
+ "optional": true
41
+ },
42
+ "@o3r/schematics": {
43
+ "optional": true
44
+ },
45
+ "@schematics/angular": {
46
+ "optional": true
47
+ }
48
+ },
49
+ "devDependencies": {
50
+ "@angular-devkit/core": "~19.2.0",
51
+ "@angular-devkit/schematics": "~19.2.0",
52
+ "@angular/compiler": "~19.2.0",
53
+ "@babel/core": "~7.27.0",
54
+ "@babel/preset-env": "~7.27.0",
55
+ "@babel/preset-typescript": "~7.27.0",
56
+ "@compodoc/compodoc": "^1.1.19",
57
+ "@eslint-community/eslint-plugin-eslint-comments": "^4.4.0",
58
+ "@nx/eslint-plugin": "~20.8.0",
59
+ "@nx/jest": "~20.8.0",
60
+ "@o3r/build-helpers": "^12.5.0-prerelease.10",
61
+ "@o3r/eslint-config": "^12.5.0-prerelease.10",
62
+ "@o3r/eslint-plugin": "^12.5.0-prerelease.10",
63
+ "@o3r/test-helpers": "^12.5.0-prerelease.10",
64
+ "@schematics/angular": "~19.2.0",
65
+ "@stylistic/eslint-plugin": "~3.1.0",
66
+ "@types/css-tree": "~2.3.0",
67
+ "@types/jest": "~29.5.2",
68
+ "@types/node": "^20.0.0",
69
+ "@typescript-eslint/parser": "~8.34.0",
70
+ "angular-eslint": "~19.4.0",
71
+ "babel-jest": "^29.7.0",
72
+ "cpy-cli": "^5.0.0",
73
+ "eslint": "~9.29.0",
74
+ "eslint-import-resolver-node": "~0.3.9",
75
+ "eslint-import-resolver-typescript": "~3.10.0",
76
+ "eslint-plugin-import": "~2.31.0",
77
+ "eslint-plugin-import-newlines": "~1.4.0",
78
+ "eslint-plugin-jest": "~28.14.0",
79
+ "eslint-plugin-jsdoc": "~50.8.0",
80
+ "eslint-plugin-prefer-arrow": "~1.2.3",
81
+ "eslint-plugin-unicorn": "~56.0.0",
82
+ "eslint-plugin-unused-imports": "~4.1.4",
83
+ "globals": "^15.9.0",
84
+ "jest": "~29.7.0",
85
+ "jest-junit": "~16.0.0",
86
+ "jsonc-eslint-parser": "~2.4.0",
87
+ "nx": "~20.8.0",
88
+ "pid-from-port": "^1.1.3",
89
+ "postcss": "~8.5.1",
90
+ "postcss-scss": "~4.0.9",
91
+ "rimraf": "^6.0.1",
92
+ "rxjs": "^7.8.1",
93
+ "semver": "^7.5.2",
94
+ "stylelint": "~16.20.0",
95
+ "ts-jest": "~29.3.0",
96
+ "ts-node": "~10.9.2",
97
+ "type-fest": "^4.30.1",
98
+ "typescript": "~5.8.2",
99
+ "typescript-eslint": "~8.34.0"
100
+ },
101
+ "main": "./src/public_api.mjs",
102
+ "schematics": "./collection.json",
103
+ "contributors": [
104
+ {
105
+ "name": "Yannick Adam",
106
+ "url": "https://github.com/yannickadam",
107
+ "email": "yannickadam@users.noreply.github.com"
108
+ },
109
+ {
110
+ "name": "Kilian Panot",
111
+ "url": "https://github.com/kpanot",
112
+ "email": "kpanot@users.noreply.github.com"
113
+ },
114
+ {
115
+ "name": "Jeremy Bourgeois",
116
+ "url": "https://github.com/jbourgeois-1A",
117
+ "email": "jbourgeois-1A@users.noreply.github.com"
118
+ },
119
+ {
120
+ "name": "Pierre Henri Ginoux",
121
+ "url": "https://github.com/pginoux-1A",
122
+ "email": "pginoux-1A@users.noreply.github.com"
123
+ },
124
+ {
125
+ "name": "Mircea Vasile Rednic",
126
+ "url": "https://github.com/mrednic-1A",
127
+ "email": "mrednic-1A@users.noreply.github.com"
128
+ },
129
+ {
130
+ "name": "Stephane Dalle",
131
+ "url": "https://github.com/sdalle-1A",
132
+ "email": "sdalle-1A@users.noreply.github.com"
133
+ },
134
+ {
135
+ "name": "Nicolas Hoffmann",
136
+ "url": "https://github.com/nhoffmann-1A",
137
+ "email": "nhoffmann-1A@users.noreply.github.com"
138
+ },
139
+ {
140
+ "name": "Victor Scaiceanu",
141
+ "url": "https://github.com/vscaiceanu-1a",
142
+ "email": "vscaiceanu-1A@users.noreply.github.com"
143
+ },
144
+ {
145
+ "name": "Florian Paul",
146
+ "url": "https://github.com/fpaul-1A",
147
+ "email": "fpaul-1A@users.noreply.github.com"
148
+ },
149
+ {
150
+ "name": "Corinne Paulve",
151
+ "url": "https://github.com/cpaulve-1A",
152
+ "email": "cpaulve-1A@users.noreply.github.com"
153
+ },
154
+ {
155
+ "name": "Matthieu Crouzet",
156
+ "url": "https://github.com/matthieu-crouzet",
157
+ "email": "matthieu-crouzet@users.noreply.github.com"
158
+ },
159
+ {
160
+ "name": "Salome Do",
161
+ "url": "https://github.com/sdo-1A",
162
+ "email": "sdo-1A@users.noreply.github.com"
163
+ }
164
+ ],
165
+ "bugs": "https://github.com/AmadeusITGroup/otter/issues",
166
+ "repository": {
167
+ "type": "git",
168
+ "url": "git+https://github.com/AmadeusITGroup/otter.git"
169
+ },
170
+ "license": "BSD-3-Clause",
171
+ "homepage": "https://amadeusitgroup.github.io/otter/"
172
+ }
@@ -0,0 +1,8 @@
1
+ import type { Rule } from '@angular-devkit/schematics';
2
+ import type { NgAddSchematicsSchema } from './schema';
3
+ /**
4
+ * Add Otter stylelint-plugin to an Angular Project
5
+ * @param options
6
+ */
7
+ export declare const ngAdd: (options: NgAddSchematicsSchema) => Rule;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,IAAI,EACL,MAAM,4BAA4B,CAAC;AAUpC,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,UAAU,CAAC;AA2ClB;;;GAGG;AACH,eAAO,MAAM,KAAK,GAAI,SAAS,qBAAqB,SAA2C,CAAC"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ngAdd = void 0;
4
+ const path = require("node:path");
5
+ const schematics_1 = require("@o3r/schematics");
6
+ const packageJsonPath = path.resolve(__dirname, '..', '..', 'package.json');
7
+ const dependenciesToInstall = [
8
+ 'postcss',
9
+ 'postcss-scss',
10
+ 'stylelint'
11
+ ];
12
+ /**
13
+ * Add Otter stylelint-plugin to an Angular Project
14
+ * @param options
15
+ */
16
+ function ngAddFn(options) {
17
+ /* ng add rules */
18
+ return async (tree, context) => {
19
+ const { NodeDependencyType } = await Promise.resolve().then(() => require('@schematics/angular/utility/dependencies'));
20
+ const depsInfo = (0, schematics_1.getO3rPeerDeps)(packageJsonPath);
21
+ const workspaceProject = options.projectName ? (0, schematics_1.getWorkspaceConfig)(tree)?.projects[options.projectName] : undefined;
22
+ const dependencies = depsInfo.o3rPeerDeps.reduce((acc, dep) => {
23
+ acc[dep] = {
24
+ inManifest: [{
25
+ range: `~${depsInfo.packageVersion}`,
26
+ types: (0, schematics_1.getProjectNewDependenciesTypes)(workspaceProject)
27
+ }]
28
+ };
29
+ return acc;
30
+ }, (0, schematics_1.getPackageInstallConfig)(packageJsonPath, tree, options.projectName, true, !!options.exactO3rVersion));
31
+ Object.entries((0, schematics_1.getExternalDependenciesVersionRange)(dependenciesToInstall, packageJsonPath, context.logger)).forEach(([dep, range]) => {
32
+ dependencies[dep] = {
33
+ inManifest: [{
34
+ range,
35
+ types: [NodeDependencyType.Dev]
36
+ }]
37
+ };
38
+ });
39
+ return (0, schematics_1.setupDependencies)({
40
+ projectName: options.projectName,
41
+ dependencies
42
+ });
43
+ };
44
+ }
45
+ /**
46
+ * Add Otter stylelint-plugin to an Angular Project
47
+ * @param options
48
+ */
49
+ const ngAdd = (options) => (0, schematics_1.createOtterSchematic)(ngAddFn)(options);
50
+ exports.ngAdd = ngAdd;
51
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,8 @@
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;
7
+ }
8
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +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,qBAAqB;IAClE,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,8CAA8C;IAC9C,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1,22 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "ngAddSchematicsSchema",
4
+ "title": "Add Otter Ama Styling stylelint-plugin ",
5
+ "description": "ngAdd Otter Ama Styling stylelint-plugin ",
6
+ "properties": {
7
+ "projectName": {
8
+ "type": "string",
9
+ "description": "Project name",
10
+ "$default": {
11
+ "$source": "projectName"
12
+ }
13
+ },
14
+ "exactO3rVersion": {
15
+ "type": "boolean",
16
+ "description": "Use a pinned version for otter packages"
17
+ }
18
+ },
19
+ "additionalProperties": true,
20
+ "required": [
21
+ ]
22
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,4 @@
1
+ import stylelint from 'stylelint';
2
+ declare const rulesPlugins: stylelint.Plugin[];
3
+ export default rulesPlugins;
4
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/index.mts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAC;AASlC,QAAA,MAAM,YAAY,oBAEjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
package/src/index.mjs ADDED
@@ -0,0 +1,7 @@
1
+ import stylelint from 'stylelint';
2
+ import { rules, } from './rules/index.mjs';
3
+ import { getNamespacedRuleName, } from './utils/get-namespaced-rule-name.mjs';
4
+ const { createPlugin } = stylelint;
5
+ const rulesPlugins = Object.entries(rules).map(([ruleName, rule]) => createPlugin(getNamespacedRuleName(ruleName), rule));
6
+ export default rulesPlugins;
7
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,2 @@
1
+ export { default } from './index.mjs';
2
+ //# sourceMappingURL=public_api.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public_api.d.mts","sourceRoot":"","sources":["../../src/public_api.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,3 @@
1
+ // Rules plugins have to be exported as default
2
+ export { default } from './index.mjs';
3
+ //# sourceMappingURL=public_api.mjs.map
@@ -0,0 +1,2 @@
1
+ export declare const rules: {};
2
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/rules/index.mts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,IAAc,CAAC"}
@@ -0,0 +1,2 @@
1
+ export const rules = {};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Generates a namespaced rule name.
3
+ * @param ruleName Name of the rule
4
+ */
5
+ export declare const getNamespacedRuleName: (ruleName: string) => string;
6
+ //# sourceMappingURL=get-namespaced-rule-name.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-namespaced-rule-name.d.mts","sourceRoot":"","sources":["../../../src/utils/get-namespaced-rule-name.mts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAAI,UAAU,MAAM,KAAG,MAAiC,CAAC"}
@@ -0,0 +1,7 @@
1
+ const prefix = '@ama-styling';
2
+ /**
3
+ * Generates a namespaced rule name.
4
+ * @param ruleName Name of the rule
5
+ */
6
+ export const getNamespacedRuleName = (ruleName) => `${prefix}/${ruleName}`;
7
+ //# sourceMappingURL=get-namespaced-rule-name.mjs.map