92 lines
3.4 KiB
TypeScript
92 lines
3.4 KiB
TypeScript
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,
|
|
},
|
|
};
|