chore: update ESLint, Stylelint and PHPCS configurations

This commit is contained in:
Jérémy Munsch 2026-07-20 17:52:37 +02:00
parent d693885a90
commit 7d4fdb3011
Signed by: forge-joniko
GPG key ID: D7EFE2F5CB6CC0E4
4 changed files with 117 additions and 165 deletions

View file

@ -1,61 +0,0 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:vue/vue3-strongly-recommended",
"@vue/eslint-config-typescript"
],
"overrides": [
{
"files": ["*.ts", "*.vue"],
"rules": {
"no-undef": "off"
}
},
{
"files": ["*.vue"],
"rules": {
"indent": "off"
}
}
],
"parser": "vue-eslint-parser",
"parserOptions": {
"parser": "@typescript-eslint/parser",
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["vue", "@typescript-eslint"],
"ignorePatterns": [
"**/*.php",
"**/*.svg",
"**/vendor/*.js",
"**/vendor/**/*.js",
"**/vendor/**/*.scss"
],
"rules": {
"indent": ["error", 4, { "SwitchCase": 1 }],
"linebreak-style": ["error", "unix"],
"quotes": ["error", "double"],
"semi": ["error", "always"],
"vue/script-indent": ["error", 2, { "baseIndent": 0, "switchCase": 1 }],
"vue/one-component-per-file": "off"
},
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".vue", ".ts", ".d.ts"]
},
"alias": {
"extensions": [".vue", ".js", ".ts", ".scss", ".d.ts"],
"map": [
["~", "./resources/assets"],
["@", "./node_modules"]
]
}
}
}
}

View file

@ -23,14 +23,12 @@
], ],
"customSyntax": "postcss-scss", "customSyntax": "postcss-scss",
"rules": { "rules": {
"declaration-property-value-no-unknown": true, "declaration-property-value-no-unknown": null,
"selector-max-id": null, "selector-max-id": null,
"color-no-invalid-hex": true, "color-no-invalid-hex": true,
"order/properties-alphabetical-order": null, "order/properties-alphabetical-order": null,
"max-nesting-depth": 5, "max-nesting-depth": 5,
"selector-max-compound-selectors": 5, "selector-max-compound-selectors": 5,
"declaration-colon-newline-after": null,
"value-list-comma-newline-after": null,
"scss/double-slash-comment-empty-line-before": [ "scss/double-slash-comment-empty-line-before": [
"always", "always",
{ {
@ -42,4 +40,4 @@
} }
] ]
} }
} }

73
eslint.config.js Normal file
View file

@ -0,0 +1,73 @@
import vueTsEslintConfig from "@vue/eslint-config-typescript";
import pluginImportX from "eslint-plugin-import-x";
import pluginVue from "eslint-plugin-vue";
export default [
// 1. Fichiers et dossiers à ignorer globalement
{
ignores: [
"**/*.php",
"**/*.svg",
"**/vendor/**",
"node_modules/**",
"public/**"
]
},
// 2. Configurations de base recommandées
...pluginVue.configs["flat/strongly-recommended"],
...vueTsEslintConfig(),
// 3. Plugin d'imports (import-x)
pluginImportX.flatConfigs.recommended,
pluginImportX.flatConfigs.typescript,
// 4. Options de langage, Paramètres et Règles globales
{
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
settings: {
// 👉 LA CORRECTION EST ICI
"import-x/resolver": {
// Apprend à ESLint à lire ces extensions
node: {
extensions: [".js", ".ts", ".vue", ".scss", ".d.ts"]
},
// Demande à ESLint de se fier à 100% à votre tsconfig.json pour les alias !
typescript: {
alwaysTryTypes: true,
project: "./tsconfig.json",
}
}
},
rules: {
"indent": ["error", 4, { "SwitchCase": 1 }],
"linebreak-style": ["error", "unix"],
"quotes": ["error", "double"],
"semi": ["error", "always"],
"vue/one-component-per-file": "off",
"import/order": "off",
},
},
// 5. Overrides pour les fichiers Vue (.vue)
{
files: ["**/*.vue"],
rules: {
"indent": "off",
"vue/script-indent": ["error", 2, { "baseIndent": 0, "switchCase": 1 }],
"no-undef": "off"
}
},
// 6. Overrides pour les fichiers TypeScript (.ts)
{
files: ["**/*.ts"],
rules: {
"no-undef": "off"
}
}
];

142
phpcs.xml
View file

@ -1,123 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ruleset name="LDC Laravel" <ruleset name="Php Coding Standard"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd"> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
<description>Created with the PHP Coding Standard Generator. http://edorian.github.com/php-coding-standard-generator/</description>
<description>Standard optimisé : Analyse statique complémentaire à Pint.</description>
<arg name="colors" /> <arg name="colors" />
<arg name="extensions" value="php" /> <arg name="extensions" value="php" />
<arg name="parallel" value="75" />
<file>app/</file> <file>app/</file>
<file>config/</file> <file>config/</file>
<file>database/</file>
<file>routes/</file> <file>routes/</file>
<exclude-pattern>app/Lib/vendor/*</exclude-pattern> <file>tests/</file>
<rule ref="PSR1" />
<rule ref="PSR12" /> <exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/storage/*</exclude-pattern>
<exclude-pattern>_ide_helper.php</exclude-pattern>
<exclude-pattern>*/tests/*</exclude-pattern>
<rule ref="PSR12"/>
<rule ref="Generic.Classes.DuplicateClassName"/>
<rule ref="Generic.CodeAnalysis.EmptyStatement"/> <rule ref="Generic.CodeAnalysis.EmptyStatement"/>
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/>
<rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall"/>
<rule ref="Generic.CodeAnalysis.JumbledIncrementer"/>
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/> <rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/> <rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
<rule ref="Generic.Commenting.DocComment.SpacingBeforeTags"/> <rule ref="Generic.Metrics.CyclomaticComplexity">
<rule ref="Generic.Commenting.Todo"/> <properties>
<rule ref="Generic.Commenting.Fixme"/> <property name="complexity" value="10"/>
<rule ref="Generic.ControlStructures.InlineControlStructure"/> <property name="absoluteComplexity" value="20"/>
<rule ref="Generic.Files.ByteOrderMark"/> </properties>
<rule ref="Generic.Files.LineEndings"/> </rule>
<rule ref="Generic.Files.LineLength"/>
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
<rule ref="Generic.Formatting.MultipleStatementAlignment"/>
<rule ref="Generic.Formatting.SpaceAfterCast"/>
<rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
<rule ref="Generic.Metrics.CyclomaticComplexity"/>
<rule ref="Generic.Metrics.NestingLevel"/> <rule ref="Generic.Metrics.NestingLevel"/>
<rule ref="Generic.NamingConventions.ConstructorName"/>
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
<rule ref="Generic.NamingConventions.CamelCapsFunctionName"/>
<rule ref="Generic.PHP.DeprecatedFunctions"/> <rule ref="Generic.PHP.DeprecatedFunctions"/>
<rule ref="Generic.PHP.DisallowShortOpenTag"/>
<rule ref="Generic.PHP.ForbiddenFunctions"/> <rule ref="Generic.PHP.ForbiddenFunctions"/>
<rule ref="Generic.PHP.NoSilencedErrors"/> <rule ref="Generic.PHP.NoSilencedErrors"/>
<rule ref="Generic.Strings.UnnecessaryStringConcat"/>
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
<rule ref="Generic.WhiteSpace.LanguageConstructSpacing"/>
<rule ref="Generic.WhiteSpace.ScopeIndent"/>
<rule ref="PEAR.Classes.ClassDeclaration"/>
<rule ref="PEAR.Commenting.InlineComment"/>
<rule ref="PSR1.Classes.ClassDeclaration"/>
<rule ref="PSR1.Files.SideEffects"/>
<rule ref="PSR2.Classes.ClassDeclaration"/>
<rule ref="PSR2.Classes.PropertyDeclaration"/>
<rule ref="PSR2.ControlStructures.ElseIfDeclaration"/>
<rule ref="PSR2.ControlStructures.SwitchDeclaration"/>
<rule ref="PSR2.Files.EndFileNewline"/>
<rule ref="PSR2.Methods.MethodDeclaration"/>
<rule ref="PSR2.Namespaces.NamespaceDeclaration"/>
<rule ref="PSR2.Namespaces.UseDeclaration"/>
<rule ref="Squiz.PHP.CommentedOutCode"/>
<rule ref="Squiz.PHP.DisallowMultipleAssignments">
<exclude name="Squiz.PHP.DisallowMultipleAssignments.FoundInControlStructure" />
</rule>
<rule ref="Squiz.PHP.DisallowSizeFunctionsInLoops"/>
<rule ref="Squiz.PHP.DiscouragedFunctions">
<properties>
<property name="error" value="true"/>
</properties>
</rule>
<rule ref="Squiz.PHP.Eval"/> <rule ref="Squiz.PHP.Eval"/>
<rule ref="Squiz.PHP.GlobalKeyword"/> <rule ref="Squiz.PHP.GlobalKeyword"/>
<rule ref="Squiz.PHP.Heredoc"/>
<rule ref="Squiz.PHP.InnerFunctions"/>
<rule ref="Squiz.PHP.LowercasePHPFunctions"/>
<rule ref="Squiz.PHP.NonExecutableCode"/> <rule ref="Squiz.PHP.NonExecutableCode"/>
<rule ref="Squiz.Scope.MemberVarScope"/>
<rule ref="Squiz.Scope.MethodScope"/>
<rule ref="Squiz.Scope.StaticThisUsage"/> <rule ref="Squiz.Scope.StaticThisUsage"/>
<rule ref="Squiz.WhiteSpace.LogicalOperatorSpacing"/>
<rule ref="Squiz.WhiteSpace.MemberVarSpacing">
<properties>
<property name="spacingBeforeFirst " value="false"/>
</properties>
</rule>
<rule ref="Squiz.WhiteSpace.OperatorSpacing">
<properties>
<property name="ignoreNewlines" value="true"/>
</properties>
</rule>
<rule ref="Squiz.WhiteSpace.ObjectOperatorSpacing">
<properties>
<property name="ignoreNewlines" value="true"/>
</properties>
</rule>
<rule ref="Squiz.WhiteSpace.ScopeKeywordSpacing"/>
<rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
<rule ref="Squiz.Commenting.BlockComment">
<exclude name="Squiz.Commenting.BlockComment.WrongStart" />
</rule>
<rule ref="Squiz.Commenting.ClassComment">
<exclude name="Squiz.Commenting.ClassComment.Missing" />
<exclude name="Squiz.Commenting.ClassComment.TagNotAllowed" />
</rule>
<rule ref="Squiz.Commenting.DocCommentAlignment"/>
<rule ref="Squiz.Commenting.EmptyCatchComment"/>
<rule ref="Squiz.Commenting.FunctionComment">
<exclude name="Squiz.Commenting.FunctionComment.MissingParamComment" />
</rule>
<rule ref="Squiz.Commenting.FunctionCommentThrowTag"/>
<rule ref="Squiz.Commenting.InlineComment">
<exclude name="Squiz.Commenting.InlineComment.DocBlock" />
</rule>
<rule ref="Squiz.Commenting.LongConditionClosingComment">
<exclude name="Squiz.Commenting.LongConditionClosingComment.SpacingBefore" />
</rule>
<rule ref="Squiz.Commenting.PostStatementComment"/>
<rule ref="Squiz.Commenting.VariableComment"/>
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses.UnusedUse" />
<!-- For Laravel migrations --> <rule ref="Generic.NamingConventions.ConstructorName"/>
<rule ref="Generic.NamingConventions.CamelCapsFunctionName"/>
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="150"/>
<property name="absoluteLineLimit" value="250"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses" />
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
<properties>
<property name="spacesCountAroundEqualsSign" value="0" />
<property name="declareOnFirstLine" value="false" />
<property name="linesCountBeforeDeclare" value="1" />
<property name="linesCountAfterDeclare" value="1" />
</properties>
</rule>
<rule ref="PSR1.Classes.ClassDeclaration.MissingNamespace"> <rule ref="PSR1.Classes.ClassDeclaration.MissingNamespace">
<exclude-pattern>*/database/migrations/*</exclude-pattern> <exclude-pattern>*/database/migrations/*</exclude-pattern>
</rule> </rule>