eslint-plugin-css
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -10,3 +10,4 @@ "use strict"; | ||
"css/no-unknown-unit": "error", | ||
"css/no-useless-color-alpha": "error", | ||
}, | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const utils_1 = require("../utils"); | ||
const color_1 = require("../utils/color"); | ||
exports.default = (0, utils_1.createRule)("no-invalid-color-hex", { | ||
@@ -37,3 +38,3 @@ meta: { | ||
const hexValue = hexMatch[0]; | ||
if (isValidHex(hexValue)) | ||
if ((0, color_1.parseHexColor)(hexValue).isValid()) | ||
return undefined; | ||
@@ -69,4 +70,1 @@ const sourceCode = context.getSourceCode(); | ||
}); | ||
function isValidHex(hex) { | ||
return /^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/iu.test(hex); | ||
} |
@@ -7,2 +7,4 @@ "use strict"; | ||
exports.rules = void 0; | ||
const color_hex_style_1 = __importDefault(require("../rules/color-hex-style")); | ||
const named_color_1 = __importDefault(require("../rules/named-color")); | ||
const no_dupe_properties_1 = __importDefault(require("../rules/no-dupe-properties")); | ||
@@ -15,2 +17,3 @@ const no_invalid_color_hex_1 = __importDefault(require("../rules/no-invalid-color-hex")); | ||
const no_unknown_unit_1 = __importDefault(require("../rules/no-unknown-unit")); | ||
const no_useless_color_alpha_1 = __importDefault(require("../rules/no-useless-color-alpha")); | ||
const number_leading_zero_1 = __importDefault(require("../rules/number-leading-zero")); | ||
@@ -20,2 +23,4 @@ const prefer_reduce_shorthand_property_box_values_1 = __importDefault(require("../rules/prefer-reduce-shorthand-property-box-values")); | ||
exports.rules = [ | ||
color_hex_style_1.default, | ||
named_color_1.default, | ||
no_dupe_properties_1.default, | ||
@@ -28,2 +33,3 @@ no_invalid_color_hex_1.default, | ||
no_unknown_unit_1.default, | ||
no_useless_color_alpha_1.default, | ||
number_leading_zero_1.default, | ||
@@ -30,0 +36,0 @@ prefer_reduce_shorthand_property_box_values_1.default, |
{ | ||
"name": "eslint-plugin-css", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "An ESLint plugin that provides rules to verify CSS definition objects.", | ||
@@ -51,2 +51,3 @@ "engines": { | ||
"dependencies": { | ||
"colord": "^2.9.1", | ||
"eslint-utils": "^3.0.0", | ||
@@ -66,2 +67,3 @@ "known-css-properties": "^0.23.0", | ||
"@types/estree": "^0.0.50", | ||
"@types/jsdom": "^16.2.13", | ||
"@types/mocha": "^9.0.0", | ||
@@ -86,2 +88,3 @@ "@types/node": "^16.10.1", | ||
"eslint-plugin-yml": "^0.11.0", | ||
"jsdom": "^18.0.1", | ||
"mocha": "^9.1.2", | ||
@@ -93,3 +96,4 @@ "mocha-chai-jest-snapshot": "^1.1.3", | ||
"stylelint": "^14.0.0", | ||
"stylelint-config-standard": "^23.0.0", | ||
"stylelint-config-recommended-vue": "^1.0.0", | ||
"stylelint-config-standard": "^24.0.0", | ||
"stylelint-plugin-stylus": "^0.13.0", | ||
@@ -96,0 +100,0 @@ "ts-node": "^10.2.1", |
@@ -27,2 +27,4 @@ # Introduction | ||
<img alt="vue" src="./docs/images/vue.png" height="150px"><img alt="jsx" src="./docs/images/jsx.png" height="150px"> | ||
[styled-components]: https://styled-components.com/docs/advanced#style-objects | ||
@@ -175,3 +177,5 @@ | ||
|:--------|:------------|:---| | ||
| [css/named-color](https://ota-meshi.github.io/eslint-plugin-css/rules/named-color.html) | enforce named colors | :wrench: | | ||
| [css/no-length-zero-unit](https://ota-meshi.github.io/eslint-plugin-css/rules/no-length-zero-unit.html) | disallow units for zero lengths | :wrench: | | ||
| [css/no-useless-color-alpha](https://ota-meshi.github.io/eslint-plugin-css/rules/no-useless-color-alpha.html) | disallow unnecessary alpha-channel transparency value | :star::wrench: | | ||
| [css/prefer-reduce-shorthand-property-box-values](https://ota-meshi.github.io/eslint-plugin-css/rules/prefer-reduce-shorthand-property-box-values.html) | require reduction in box values of shorthand property | :wrench: | | ||
@@ -183,2 +187,3 @@ | ||
|:--------|:------------|:---| | ||
| [css/color-hex-style](https://ota-meshi.github.io/eslint-plugin-css/rules/color-hex-style.html) | enforce hex color style | :wrench: | | ||
| [css/no-number-trailing-zeros](https://ota-meshi.github.io/eslint-plugin-css/rules/no-number-trailing-zeros.html) | disallow trailing zeros in numbers. | :wrench: | | ||
@@ -185,0 +190,0 @@ | [css/number-leading-zero](https://ota-meshi.github.io/eslint-plugin-css/rules/number-leading-zero.html) | require or disallow a leading zero for fractional numbers less than 1 | :wrench: | |
148888
43
3662
227
5
41
+ Addedcolord@^2.9.1
+ Addedcolord@2.9.3(transitive)