Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions e2e/plugin-stylelint-e2e/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import tseslint from 'typescript-eslint';
import baseConfig from '../../eslint.config.js';

export default tseslint.config(...baseConfig, {
files: ['**/*.ts'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["stylelint-config-standard"],
"rules": {
"color-no-invalid-hex": true,
"declaration-colon-space-after": "always",
"declaration-colon-space-before": "never",
"indentation": 2,
"declaration-block-trailing-semicolon": "always",
"declaration-block-no-duplicate-properties": true,
"block-opening-brace-space-before": "always",
"string-quotes": "double",
"max-line-length": 80,
"no-eol-whitespace": true,
"block-no-empty": true,
"no-missing-end-of-source-newline": true,
"declaration-block-no-redundant-longhand-properties": true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import stylelintPlugin from '@code-pushup/stylelint-plugin';
import type { CoreConfig } from '@code-pushup/models';

export default {
plugins: [
await stylelintPlugin({
stylelintrc: '.stylelintrc.json',
patterns: ['**/*.css'],
}),
],
} satisfies CoreConfig;
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* Additional CSS file for testing multiple file patterns */

.card {
border: 1px solid #ccc;
padding: 16px;
margin: 8px;
}

.card-header {
font-weight: bold;
margin-bottom: 8px;
}

.card-body {
line-height: 1.4;
}

/* Valid CSS with no issues */
.well-formatted {
display: flex;
flex-direction: column;
gap: 12px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* CSS file in nested directory */

.nested-component {
position: relative;
z-index: 10;
}

/* Issue: missing space after colon */
.nested-issue {
color: blue;
}
73 changes: 73 additions & 0 deletions e2e/plugin-stylelint-e2e/mocks/fixtures/default-setup/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/* Mock CSS file with various stylelint issues for e2e testing */

/* Missing space after colon */
.header {
color: red;
background-color: #ffffff;
}

/* Inconsistent indentation */
.navigation {
padding: 10px;
margin: 5px;
}

/* Wrong unit usage */
.footer {
font-size: 14px;
line-height: 1.5;
margin: 0px; /* Should use 0 instead of 0px */
}

/* Duplicate properties */
.sidebar {
width: 200px;
width: 250px;
height: 100%;
}

/* Invalid hex color */
.content {
color: #fff;
background: #12345;
}

/* Unnecessary vendor prefixes */
.button {
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}

/* Missing space before opening brace */
.modal {
position: fixed;
top: 50%;
}

/* Trailing whitespace and empty rules */
.empty {
}

/* Inconsistent quotes */
.mixed-quotes {
font-family: 'Arial', 'Helvetica', sans-serif;
}

/* Long line that should be wrapped */
.long-line {
background: linear-gradient(
to right,
#ff0000,
#00ff00,
#0000ff,
#ffff00,
#ff00ff,
#00ffff
);
}

/* Missing final newline */
.last-rule {
display: block;
}
17 changes: 17 additions & 0 deletions e2e/plugin-stylelint-e2e/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "plugin-stylelint-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "e2e/plugin-stylelint-e2e/src",
"projectType": "application",
"targets": {
"lint": {},
"e2e": {
"executor": "@nx/vitest:test",
"options": {
"configFile": "{projectRoot}/vitest.e2e.config.ts"
}
}
},
"implicitDependencies": ["@code-pushup/plugin-stylelint"],
"tags": ["scope:plugin", "type:e2e"]
}
Loading