Skip to content

Commit

Permalink
fix tests; remove deprecated stylelint-config-slds; added @stylistic/…
Browse files Browse the repository at this point in the history
…stylelint-plugin; improve README;
  • Loading branch information
codacy-vrhpires committed Jun 21, 2024
1 parent c37321b commit 8aac80d
Show file tree
Hide file tree
Showing 9 changed files with 177 additions and 135 deletions.
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,22 @@ Docker engine to allow Codacy to have [stylelint](https://github.com/stylelint/s

## Usage

You can create the docker by following these steps:
Create the docker:

1. Generate tool binary

1) Generate base image:
```sh
docker build -t codacy-stylelint-base .
sbt stage
```

2) Generate tool image:
2. Generate tool docker

```sh
sbt docker:publishLocal
docker build -t codacy-stylelint .
```

The docker is ran with the following command:

Run docker:

```sh
docker run -it -v $srcDir:/src <DOCKER_NAME>:<DOCKER_VERSION>
Expand Down
14 changes: 8 additions & 6 deletions docs/multiple-tests/all-patterns-config/results.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<checkstyle version="1.5">
<file name="noTestResults.css">
<error source="color-hex-length" line="2" message="Expected &quot;#aaaaaa&quot; to be &quot;#aaa&quot; (color-hex-length)" severity="info" />
<error source="indentation" line="2" message="Expected indentation of 2 spaces (indentation)" severity="info" />
<error source="scale-unlimited/declaration-strict-value" line="2" message="Expected variable or function for &quot;#aaaaaa&quot; of &quot;color&quot; (scale-unlimited/declaration-strict-value)" severity="info" />
<error source="sh-waqar/declaration-use-variable" line="1" message="Unknown rule sh-waqar/declaration-use-variable." severity="info" />
</file>
<file name="noTestResults.css">
<error source="no-missing-end-of-source-newline" line="1" message="Unknown rule no-missing-end-of-source-newline." severity="info" />
<error source="@stylistic/indentation" line="2" message="Expected indentation of 2 spaces (@stylistic/indentation)" severity="info" />
<error source="color-hex-length" line="2" message="Expected &quot;#aaaaaa&quot; to be &quot;#aaa&quot; (color-hex-length)" severity="info" />
<error source="prettier/prettier" line="1" message="Delete &quot;&quot; (prettier/prettier)" severity="info" />
<error source="prettier/prettier" line="3" message="Delete &quot;&quot; (prettier/prettier)" severity="info" />
<error source="prettier/prettier" line="2" message="Replace &quot;····color:·#aaaaaa;␍&quot; with &quot;··color:·#aaaaaa;&quot; (prettier/prettier)" severity="info" />
</file>
</checkstyle>
17 changes: 12 additions & 5 deletions docs/multiple-tests/all-patterns-config/src/.stylelintrc
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
{
"extends": [
"stylelint-config-css-modules",
"stylelint-config-standard",
"stylelint-config-slds"
"stylelint-config-sass-guidelines",
"stylelint-config-standard-scss",
"stylelint-config-styled-components",
"stylelint-config-tailwindcss",
"stylelint-config-twbs-bootstrap",
"stylelint-prettier/recommended"
],
"plugins":[
"stylelint-order",
"stylelint-scss",
"@stylistic/stylelint-plugin",
"stylelint-declaration-strict-value",
"stylelint-no-px",
"stylelint-scss",
"stylelint-selector-bem-pattern",
"stylelint-suitcss",
"stylelint-selector-bem-pattern"
],
"rules": {
"scale-unlimited/declaration-strict-value": "color",
"sh-waqar/declaration-use-variable": "/color/",
"plugin/selector-bem-pattern": {
"componentName": "[A-Z]+",
"componentSelectors": {
Expand Down
5 changes: 4 additions & 1 deletion docs/multiple-tests/no-crash/src/.stylelintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"plugins": [
"@stylistic/stylelint-plugin"
],
"rules": {
"color-hex-case": "lower"
"@stylistic/color-hex-case": "lower"
}
}
54 changes: 27 additions & 27 deletions docs/multiple-tests/with-config-file/results.xml
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
<?xml version="1.0" encoding="utf-8" ?>
<checkstyle version="1.5">
<file name="test1.css">
<error source="alpha-value-notation" line="15" message="Expected &quot;0.2&quot; to be &quot;20%&quot; (alpha-value-notation)" severity="info" />
<error source="color-function-notation" line="15" message="Expected modern color-function notation (color-function-notation)" severity="info" />
<error source="color-hex-case" line="2" message="Expected &quot;#aaaAaa&quot; to be &quot;#aaaaaa&quot; (color-hex-case)" severity="info" />
<error source="color-hex-length" line="2" message="Expected &quot;#aaaAaa&quot; to be &quot;#aaa&quot; (color-hex-length)" severity="info" />
<error source="length-zero-no-unit" line="15" message="Unexpected unit (length-zero-no-unit)" severity="info" />
<error source="length-zero-no-unit" line="15" message="Unexpected unit (length-zero-no-unit)" severity="info" />
<error source="number-leading-zero" line="15" message="Unexpected leading zero (number-leading-zero)" severity="info" />
</file>
<file name="test2.less">
<error source="alpha-value-notation" line="14" message="Expected &quot;0.2&quot; to be &quot;20%&quot; (alpha-value-notation)" severity="info" />
<error source="color-function-notation" line="14" message="Expected modern color-function notation (color-function-notation)" severity="info" />
<error source="color-hex-case" line="2" message="Expected &quot;#aaaAaa&quot; to be &quot;#aaaaaa&quot; (color-hex-case)" severity="info" />
<error source="color-hex-length" line="2" message="Expected &quot;#aaaAaa&quot; to be &quot;#aaa&quot; (color-hex-length)" severity="info" />
<error source="length-zero-no-unit" line="14" message="Unexpected unit (length-zero-no-unit)" severity="info" />
<error source="length-zero-no-unit" line="14" message="Unexpected unit (length-zero-no-unit)" severity="info" />
<error source="number-leading-zero" line="14" message="Unexpected leading zero (number-leading-zero)" severity="info" />
</file>
<file name="test3.scss">
<error source="alpha-value-notation" line="14" message="Expected &quot;0.2&quot; to be &quot;20%&quot; (alpha-value-notation)" severity="info" />
<error source="color-function-notation" line="14" message="Expected modern color-function notation (color-function-notation)" severity="info" />
<error source="color-hex-case" line="2" message="Expected &quot;#aaaAaa&quot; to be &quot;#aaaaaa&quot; (color-hex-case)" severity="info" />
<error source="color-hex-length" line="2" message="Expected &quot;#aaaAaa&quot; to be &quot;#aaa&quot; (color-hex-length)" severity="info" />
<error source="length-zero-no-unit" line="14" message="Unexpected unit (length-zero-no-unit)" severity="info" />
<error source="length-zero-no-unit" line="14" message="Unexpected unit (length-zero-no-unit)" severity="info" />
<error source="number-leading-zero" line="14" message="Unexpected leading zero (number-leading-zero)" severity="info" />
</file>
<file name="test1.css">
<error source="alpha-value-notation" line="15" message="Expected &quot;0.2&quot; to be &quot;20%&quot; (alpha-value-notation)" severity="info" />
<error source="color-function-notation" line="15" message="Expected modern color-function notation (color-function-notation)" severity="info" />
<error source="@stylistic/color-hex-case" line="2" message="Expected &quot;#aaaAaa&quot; to be &quot;#aaaaaa&quot; (@stylistic/color-hex-case)" severity="info" />
<error source="color-hex-length" line="2" message="Expected &quot;#aaaAaa&quot; to be &quot;#aaa&quot; (color-hex-length)" severity="info" />
<error source="length-zero-no-unit" line="15" message="Unexpected unit (length-zero-no-unit)" severity="info" />
<error source="length-zero-no-unit" line="15" message="Unexpected unit (length-zero-no-unit)" severity="info" />
<error source="@stylistic/number-leading-zero" line="15" message="Unexpected leading zero (@stylistic/number-leading-zero)" severity="info" />
</file>
<file name="test2.less">
<error source="alpha-value-notation" line="14" message="Expected &quot;0.2&quot; to be &quot;20%&quot; (alpha-value-notation)" severity="info" />
<error source="color-function-notation" line="14" message="Expected modern color-function notation (color-function-notation)" severity="info" />
<error source="@stylistic/color-hex-case" line="2" message="Expected &quot;#aaaAaa&quot; to be &quot;#aaaaaa&quot; (@stylistic/color-hex-case)" severity="info" />
<error source="color-hex-length" line="2" message="Expected &quot;#aaaAaa&quot; to be &quot;#aaa&quot; (color-hex-length)" severity="info" />
<error source="length-zero-no-unit" line="14" message="Unexpected unit (length-zero-no-unit)" severity="info" />
<error source="length-zero-no-unit" line="14" message="Unexpected unit (length-zero-no-unit)" severity="info" />
<error source="@stylistic/number-leading-zero" line="14" message="Unexpected leading zero (@stylistic/number-leading-zero)" severity="info" />
</file>
<file name="test3.scss">
<error source="alpha-value-notation" line="14" message="Expected &quot;0.2&quot; to be &quot;20%&quot; (alpha-value-notation)" severity="info" />
<error source="color-function-notation" line="14" message="Expected modern color-function notation (color-function-notation)" severity="info" />
<error source="@stylistic/color-hex-case" line="2" message="Expected &quot;#aaaAaa&quot; to be &quot;#aaaaaa&quot; (@stylistic/color-hex-case)" severity="info" />
<error source="color-hex-length" line="2" message="Expected &quot;#aaaAaa&quot; to be &quot;#aaa&quot; (color-hex-length)" severity="info" />
<error source="length-zero-no-unit" line="14" message="Unexpected unit (length-zero-no-unit)" severity="info" />
<error source="length-zero-no-unit" line="14" message="Unexpected unit (length-zero-no-unit)" severity="info" />
<error source="@stylistic/number-leading-zero" line="14" message="Unexpected leading zero (@stylistic/number-leading-zero)" severity="info" />
</file>
</checkstyle>
71 changes: 38 additions & 33 deletions docs/multiple-tests/with-config-file/src/.stylelintrc
Original file line number Diff line number Diff line change
@@ -1,50 +1,55 @@
{
"extends": "stylelint-config-standard",
"extends": [
"stylelint-config-standard"
],
"plugins": [
"@stylistic/stylelint-plugin"
],
"rules": {
"color-hex-case": "lower",
"@stylistic/block-closing-brace-empty-line-before": "never",
"@stylistic/block-closing-brace-newline-before": "always",
"block-no-empty": true,
"@stylistic/block-opening-brace-newline-after": "always",
"@stylistic/color-hex-case": "lower",
"color-named": "never" ,
"color-no-invalid-hex": true,
"@stylistic/declaration-bang-space-after": "never",
"@stylistic/declaration-bang-space-before": "always",
"declaration-block-no-duplicate-properties": true,
"declaration-block-no-redundant-longhand-properties": true,
"declaration-block-no-shorthand-property-overrides": true,
"@stylistic/declaration-block-semicolon-newline-after": "always",
"declaration-block-single-line-max-declarations": 1,
"@stylistic/declaration-block-trailing-semicolon": "always",
"@stylistic/declaration-colon-newline-after": "always-multi-line",
"@stylistic/declaration-colon-space-after": "always",
"@stylistic/declaration-colon-space-before": "never",
"declaration-empty-line-before": "never",
"declaration-no-important": true,
"font-weight-notation": "numeric",
"function-calc-no-unspaced-operator": true,
"function-comma-newline-after": "never-multi-line",
"function-comma-space-after": "always",
"function-comma-space-before": "never",
"@stylistic/function-comma-newline-after": "never-multi-line",
"@stylistic/function-comma-space-after": "always",
"@stylistic/function-comma-space-before": "never",
"function-linear-gradient-no-nonstandard-direction": true,
"function-name-case": "lower",
"function-parentheses-newline-inside": "never-multi-line",
"function-parentheses-space-inside": "never",
"@stylistic/function-parentheses-newline-inside": "never-multi-line",
"@stylistic/function-parentheses-space-inside": "never",
"function-url-scheme-disallowed-list": "data",
"function-url-no-scheme-relative": true,
"function-url-quotes": "always",
"function-whitespace-after": "always",
"number-leading-zero": "never",
"number-no-trailing-zeros": true,
"@stylistic/function-whitespace-after": "always",
"@stylistic/number-leading-zero": "never",
"@stylistic/number-no-trailing-zeros": true,
"@stylistic/property-case": "lower",
"property-no-unknown": true,
"shorthand-property-no-redundant-values": true,
"string-no-newline": true,
"string-quotes": "single",
"@stylistic/string-quotes": "single",
"time-min-milliseconds": 100,
"unit-case": "lower",
"@stylistic/unit-case": "lower",
"unit-no-unknown": true,
"value-keyword-case": "lower",
"shorthand-property-no-redundant-values": true,
"property-case": "lower",
"property-no-unknown": true,
"declaration-bang-space-after": "never",
"declaration-bang-space-before": "always",
"declaration-colon-newline-after": "always-multi-line",
"declaration-colon-space-after": "always",
"declaration-colon-space-before": "never",
"declaration-empty-line-before": "never",
"declaration-no-important": true,
"declaration-block-no-duplicate-properties": true,
"declaration-block-no-redundant-longhand-properties": true,
"declaration-block-no-shorthand-property-overrides": true,
"declaration-block-semicolon-newline-after": "always",
"declaration-block-single-line-max-declarations": 1,
"declaration-block-trailing-semicolon": "always",
"block-closing-brace-empty-line-before": "never",
"block-no-empty": true,
"block-opening-brace-newline-after": "always",
"block-closing-brace-newline-before": "always"
"value-keyword-case": "lower"
},
"overrides": [
{
Expand Down
Loading

0 comments on commit 8aac80d

Please sign in to comment.