This commit is contained in:
gcch 2025-09-27 16:19:59 +02:00
commit 4d2186b8a8
15 changed files with 1269 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
node_modules

3
.prettierignore Normal file
View file

@ -0,0 +1,3 @@
bun.lock
dist
node_modules

1
README.md Normal file
View file

@ -0,0 +1 @@
# @gcch/configuration-stylelint

1015
bun.lock Normal file

File diff suppressed because it is too large Load diff

4
cspell.json Normal file
View file

@ -0,0 +1,4 @@
{
"dictionaries": ["fr-fr", "en-gb"],
"words": ["Navigateur", "tsdown", "Descriptionless"]
}

6
dist/index.d.ts vendored Normal file
View file

@ -0,0 +1,6 @@
import Stylelint from "stylelint";
//#region index.d.ts
declare const configCss: Readonly<Stylelint.Config>;
//#endregion
export { configCss };

1
dist/index.js vendored Normal file
View file

@ -0,0 +1 @@
import e from"stylelint";import{propertyGroups as t}from"stylelint-config-clean-order";const n=t.map(e=>({emptyLineBefore:`never`,noEmptyLineBetween:!0,properties:e})),r={allowEmptyInput:!1,cache:!0,extends:[`stylelint-config-clean-order`,`stylelint-config-standard`],ignoreFiles:[`node_modules/**`,`dist/**`,`**/reset.css`,`**/*.min.css`],plugins:[`stylelint-declaration-block-no-ignored-properties`,`stylelint-gamut`,`stylelint-no-unresolved-module`,`stylelint-no-unsupported-browser-features`,`stylelint-plugin-logical-css`,`stylelint-value-no-unknown-custom-properties`],reportDescriptionlessDisables:!0,reportInvalidScopeDisables:!0,reportNeedlessDisables:!0,reportUnscopedDisables:!0,rules:{"color-function-alias-notation":`with-alpha`,"color-function-notation":`modern`,"color-no-hex":!0,"custom-property-pattern":null,"declaration-block-no-duplicate-custom-properties":!0,"declaration-block-no-duplicate-properties":!0,"declaration-block-no-redundant-longhand-properties":!0,"declaration-block-no-shorthand-property-overrides":!0,"function-disallowed-list":[`rgba`,`hsla`,`rgb`,`hsl`],"gamut/color-no-out-gamut-range":!0,"max-nesting-depth":null,"no-descending-specificity":null,"no-duplicate-selectors":[!0,{disallowInList:!1}],"order/properties-order":[n,{severity:`error`,unspecified:`bottomAlphabetical`}],"plugin/declaration-block-no-ignored-properties":!0,"plugin/no-unresolved-module":!0,"plugin/no-unsupported-browser-features":[!0,{ignore:[`css-selection`,`css-nesting`,`css-media-range-syntax`],ignorePartialSupport:!0,severity:`warning`}],"plugin/use-logical-properties-and-values":[!0,{severity:`warning`}],"plugin/use-logical-units":[!0,{severity:`warning`}],"selector-class-pattern":null,"selector-id-pattern":null,"selector-max-compound-selectors":null,"selector-max-id":null,"selector-no-qualifying-type":null}};export{r as configCss};

4
eslint.config.ts Normal file
View file

@ -0,0 +1,4 @@
import { configTypescriptNavigateur } from "@gcch/configuration-eslint";
import { defineConfig } from "eslint/config";
export default defineConfig([...configTypescriptNavigateur]);

92
index.ts Normal file
View file

@ -0,0 +1,92 @@
import Stylelint from "stylelint";
// @ts-expect-error -- La dépendance ne dispose pas de types.
import { propertyGroups } from "stylelint-config-clean-order";
type GroupesPropriétés = ReadonlyArray<ReadonlyArray<string>>;
type OrdrePropriétés = Readonly<{
emptyLineBefore: string;
noEmptyLineBetween: boolean;
properties: ReadonlyArray<string>;
}>;
const ordrePropriétés: ReadonlyArray<OrdrePropriétés> = (propertyGroups as GroupesPropriétés).map(
(propriétés: ReadonlyArray<string>): OrdrePropriétés => ({
emptyLineBefore: "never",
noEmptyLineBetween: true,
properties: propriétés,
}),
);
export const configCss: Readonly<Stylelint.Config> = {
allowEmptyInput: false,
cache: true,
extends: ["stylelint-config-clean-order", "stylelint-config-standard"],
ignoreFiles: ["node_modules/**", "dist/**", "**/reset.css", "**/*.min.css"],
plugins: [
"stylelint-declaration-block-no-ignored-properties",
"stylelint-gamut",
"stylelint-no-unresolved-module",
"stylelint-no-unsupported-browser-features",
"stylelint-plugin-logical-css",
"stylelint-value-no-unknown-custom-properties",
],
reportDescriptionlessDisables: true,
reportInvalidScopeDisables: true,
reportNeedlessDisables: true,
reportUnscopedDisables: true,
rules: {
/**
* Force l'utilisation de notations avec canal alpha pour les couleurs.
*
* @link [color-function-alias-notation](https://stylelint.io/user-guide/rules/color-function-alias-notation)
*/
"color-function-alias-notation": "with-alpha",
/**
* Force l'utilisation de notations modernes pour les couleurs.
*
* @link [color-function-notation](https://stylelint.io/user-guide/rules/color-function-notation)
*/
"color-function-notation": "modern",
/**
* Interdit l'usage de notations hexadécimales pour les couleurs.
*
* @link [color-no-hex](https://stylelint.io/user-guide/rules/color-no-hex)
*/
"color-no-hex": true,
"custom-property-pattern": null,
"declaration-block-no-duplicate-custom-properties": true,
"declaration-block-no-duplicate-properties": true,
"declaration-block-no-redundant-longhand-properties": true,
"declaration-block-no-shorthand-property-overrides": true,
"function-disallowed-list": ["rgba", "hsla", "rgb", "hsl"],
"gamut/color-no-out-gamut-range": true,
"max-nesting-depth": null,
"no-descending-specificity": null,
"no-duplicate-selectors": [true, { disallowInList: false }],
"order/properties-order": [ordrePropriétés, { severity: "error", unspecified: "bottomAlphabetical" }],
"plugin/declaration-block-no-ignored-properties": true,
"plugin/no-unresolved-module": true,
"plugin/no-unsupported-browser-features": [
true,
{
ignore: [
// Incompatible avec Safari iOS mais ne change rien.
"css-selection",
// L'imbrication est prise en charge depuis au moins 2 ans.
"css-nesting",
// Safari...
"css-media-range-syntax",
],
ignorePartialSupport: true,
severity: "warning",
},
],
"plugin/use-logical-properties-and-values": [true, { severity: "warning" }],
"plugin/use-logical-units": [true, { severity: "warning" }],
"selector-class-pattern": null,
"selector-id-pattern": null,
"selector-max-compound-selectors": null,
"selector-max-id": null,
"selector-no-qualifying-type": null,
},
};

26
justfile Normal file
View file

@ -0,0 +1,26 @@
set shell := ["/usr/bin/fish", "-c"]
# Formate le code.
formate:
bun prettier -uw .
dprint fmt
# Met à jour les dépendances NPM.
maj-dependances:
bun update
# Analyse le code TypeScript avec ESLint.
analyse-code:
bun eslint
# Compile le projet.
compile:
bun tsdown --attw --publint --unused
# Nettoie le dosiser de compilation.
nettoie:
rm -rfv dist
# Publie le paquet sur le registre local.
publie:
npm publish --registry http://localhost:4873

43
package.json Normal file
View file

@ -0,0 +1,43 @@
{
"name": "@gcch/configuration-stylelint",
"version": "0.0.1",
"type": "module",
"description": "Configuration Stylelint partageable pour gcch.",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"module": "./dist/index.js",
"exports": {
".": "./dist/index.js",
"./package.json": "./package.json"
},
"files": [
"dist"
],
"peerDependencies": {
"browserslist": "^4.26.2",
"stylelint": "^16.24.0"
},
"dependencies": {
"stylelint-config-clean-order": "^7.0.0",
"stylelint-config-standard": "^39.0.0",
"stylelint-declaration-block-no-ignored-properties": "^2.8.0",
"stylelint-gamut": "^1.3.4",
"stylelint-no-unresolved-module": "^2.4.0",
"stylelint-no-unsupported-browser-features": "^8.0.4",
"stylelint-plugin-logical-css": "^1.2.3",
"stylelint-value-no-unknown-custom-properties": "^6.0.1"
},
"devDependencies": {
"@arethetypeswrong/core": "^0.18.2",
"@gcch/configuration-eslint": "^0.0.3",
"@gcch/configuration-prettier": "^0.0.6",
"eslint": "^9.36.0",
"prettier": "^4.0.0-alpha.12",
"publint": "^0.3.13",
"tsdown": "latest",
"unplugin-unused": "^0.5.3"
},
"browserslist": [
"baseline widely available"
]
}

5
prettier.config.js Normal file
View file

@ -0,0 +1,5 @@
import { configClassique } from "@gcch/configuration-prettier";
export default {
...configClassique,
};

5
stylelint.config.ts Normal file
View file

@ -0,0 +1,5 @@
import { configCss } from ".";
export default {
...configCss,
};

51
tsconfig.json Normal file
View file

@ -0,0 +1,51 @@
{
"compilerOptions": {
"allowArbitraryExtensions": true,
"allowImportingTsExtensions": true,
"allowJs": true,
"allowSyntheticDefaultImports": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"alwaysStrict": true,
"checkJs": true,
"downlevelIteration": false,
"erasableSyntaxOnly": true,
"esModuleInterop": true,
"exactOptionalPropertyTypes": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"lib": ["ESNext"],
"module": "ESNext",
"moduleDetection": "force",
"moduleResolution": "Bundler",
"noEmit": true,
"noErrorTruncation": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noPropertyAccessFromIndexSignature": true,
"noStrictGenericChecks": false,
"noUncheckedIndexedAccess": true,
"noUncheckedSideEffectImports": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"skipLibCheck": false,
"strict": true,
"strictBindCallApply": true,
"strictBuiltinIteratorReturn": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"suppressExcessPropertyErrors": false,
"suppressImplicitAnyIndexErrors": false,
"target": "ESNext",
"types": ["node"],
"useDefineForClassFields": true,
"useUnknownInCatchVariables": true,
"verbatimModuleSyntax": true
},
"exclude": ["dist"],
"include": ["**/*.js", "**/*.ts", "stylelint.config.ts"]
}

12
tsdown.config.ts Normal file
View file

@ -0,0 +1,12 @@
import { defineConfig } from "tsdown";
export default defineConfig({
clean: true,
dts: { oxc: true, parallel: true },
entry: ["./index.ts"],
minify: true,
platform: "node",
sourcemap: false,
target: "esnext",
treeshake: true,
});