Skip to content

feat!: separate parsing from linting #123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 17, 2025
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.cursor
/nbproject/
/vendor
/tools/vendor
Expand Down
22 changes: 11 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ shell: ## Execute shell in given PHP version container
@$(call run-php,bash)

test: ## Execute tests for given PHP version
@$(call run-php,composer test $(filter-out $@,$(MAKECMDGOALS)))
@$(call run-php,composer test -- $(filter-out $@,$(MAKECMDGOALS)))

test-update: ## Execute tests and update snapshots for given PHP version
@$(call run-php,composer test:update-snapshot $(filter-out $@,$(MAKECMDGOALS)))
test-ci: ## Execute tests and CI for given PHP version
@$(call run-php,composer test:ci -- $(filter-out $@,$(MAKECMDGOALS)))

test-load-fixtures: ## Execute tests and load fixtures for given PHP version
@$(call run-php,composer test:load-fixtures $(filter-out $@,$(MAKECMDGOALS)))
@$(call run-php,composer test:load-fixtures -- $(filter-out $@,$(MAKECMDGOALS)))

lint: ## Execute lint for given PHP version
$(MAKE) php-cs-fixer $(filter-out $@,$(MAKECMDGOALS))
Expand All @@ -43,25 +43,25 @@ lint-fix: ## Execute lint fixing for given PHP version
$(MAKE) rector-fix $(filter-out $@,$(MAKECMDGOALS))

php-cs-fixer: ## Execute php-cs-fixer for given PHP version
@$(call run-php,composer php-cs-fixer $(filter-out $@,$(MAKECMDGOALS)))
@$(call run-php,composer php-cs-fixer -- $(filter-out $@,$(MAKECMDGOALS)))

php-cs-fixer-fix: ## Execute php-cs-fixer fixing for given PHP version
@$(call run-php,composer php-cs-fixer:fix $(filter-out $@,$(MAKECMDGOALS)))
@$(call run-php,composer php-cs-fixer:fix -- $(filter-out $@,$(MAKECMDGOALS)))

rector: ## Execute rector for given PHP version
@$(call run-php,composer rector $(filter-out $@,$(MAKECMDGOALS)))
@$(call run-php,composer rector -- $(filter-out $@,$(MAKECMDGOALS)))

rector-fix: ## Execute rector fixing for given PHP version
@$(call run-php,composer rector:fix $(filter-out $@,$(MAKECMDGOALS)))
@$(call run-php,composer rector:fix -- $(filter-out $@,$(MAKECMDGOALS)))

phpstan: ## Execute PHPStan for given PHP version
@$(call run-php,composer phpstan $(filter-out $@,$(MAKECMDGOALS)))
@$(call run-php,composer phpstan -- $(filter-out $@,$(MAKECMDGOALS)))

ci: ## Execute CI scripts for given PHP version
@$(call run-php,composer ci $(filter-out $@,$(MAKECMDGOALS)))
@$(call run-php,composer ci -- $(filter-out $@,$(MAKECMDGOALS)))

generate-css-referentials: ## Generate referentials for given PHP version
@$(call run-php,composer generate-css-referentials $(filter-out $@,$(MAKECMDGOALS)))
@$(call run-php,composer generate-css-referentials -- $(filter-out $@,$(MAKECMDGOALS)))

## Run PHP for given version
define run-php
Expand Down
14 changes: 1 addition & 13 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,7 @@
->withAttributesSets(
all: true
)
->withPreparedSets(
deadCode: true,
codeQuality: true,
codingStyle: true,
typeDeclarations: true,
privatization: true,
naming: true,
instanceOf: true,
earlyReturn: true,
strictBooleans: true,
carbon: true,
rectorPreset: true,
phpunitCodeQuality: true,
->withComposerBased(
phpunit: true,
)
->withCache(
Expand Down
29 changes: 29 additions & 0 deletions scripts/css-referential-generator
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ $missingNonStandardsAtRules = [
'theme',
'tailwind'
];

foreach ($missingNonStandardsAtRules as $atRuleName) {
if (isset($standardsAtRules[$atRuleName]) || isset($nonStandardsAtRules[$atRuleName])) {
throw new Exception("At-rules $atRuleName already exists in either standards or non-standards at-rules.");
Expand All @@ -84,3 +85,31 @@ ksort($standardsAtRules);
saveReferentialData(CssLint\Referential\Standard\AtRulesReferential::class, $standardsAtRules);
ksort($nonStandardsAtRules);
saveReferentialData(CssLint\Referential\NonStandard\AtRulesReferential::class, $nonStandardsAtRules);

$cssAtRulesPropertiesFile = __DIR__ . '/../tests/fixtures/css-at-rules-properties.json';
$cssAtRulesProperties = json_decode(file_get_contents($cssAtRulesPropertiesFile), true);
$standardsAtRulesProperties = [];
$nonStandardsAtRulesProperties = [];

foreach ($cssAtRulesProperties as $atRuleName => $atRule) {
foreach ($atRule as $propertyName => $property) {
$isStandard = $property['standard'] ?? false;
if ($isStandard) {
$standardsAtRulesProperties[$atRuleName][$propertyName] = true;
} else {
$nonStandardsAtRulesProperties[$atRuleName][$propertyName] = true;
}
}
}

ksort($standardsAtRulesProperties);
foreach ($standardsAtRulesProperties as $atRuleName => $properties) {
ksort($standardsAtRulesProperties[$atRuleName]);
}
saveReferentialData(CssLint\Referential\Standard\AtRulesPropertiesReferential::class, $standardsAtRulesProperties);

ksort($nonStandardsAtRulesProperties);
foreach ($nonStandardsAtRulesProperties as $atRuleName => $properties) {
ksort($nonStandardsAtRulesProperties[$atRuleName]);
}
saveReferentialData(CssLint\Referential\NonStandard\AtRulesPropertiesReferential::class, $nonStandardsAtRulesProperties);
5 changes: 5 additions & 0 deletions scripts/css-referential-scraper
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ $cssAtRulesFile = __DIR__ . '/../tests/fixtures/css-at-rules.json';
$scraper->saveToJson($referentials['at-rules'], $cssAtRulesFile);
echo "Saved to {$cssAtRulesFile}\n";

echo "Fetched " . count($referentials['at-rules-properties']) . " at-rule property(s)\n";
$cssAtRulesPropertiesFile = __DIR__ . '/../tests/fixtures/css-at-rules-properties.json';
$scraper->saveToJson($referentials['at-rules-properties'], $cssAtRulesPropertiesFile);
echo "Saved to {$cssAtRulesPropertiesFile}\n";

echo "Done.\n";
12 changes: 0 additions & 12 deletions src/CssLint/CharLinter/CharLinter.php

This file was deleted.

67 changes: 0 additions & 67 deletions src/CssLint/CharLinter/CommentCharLinter.php

This file was deleted.

39 changes: 0 additions & 39 deletions src/CssLint/CharLinter/EndOfLineCharLinter.php

This file was deleted.

49 changes: 0 additions & 49 deletions src/CssLint/CharLinter/ImportCharLinter.php

This file was deleted.

Loading