added all files to project

This commit is contained in:
partoschph68073 committed 2022-03-10 10:36:59 +01:00
1 parent 09dd957b33
commit 46a936d7de
25351 files changed
+3883356

No files matched your search

@@ -0,0 +1,69 @@
# declaration-block-no-shorthand-property-overrides
Disallow shorthand properties that override related longhand properties.
<!-- prettier-ignore -->
```css
a { background-repeat: repeat; background: green; }
/** ↑
* This overrides the longhand property before it */
```
In almost every case, this is just an authorial oversight. For more about this behavior, see [MDN's documentation of shorthand properties](https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties).
## Options
### `true`
The following patterns are considered violations:
<!-- prettier-ignore -->
```css
a {
padding-left: 10px;
padding: 20px;
}
```
<!-- prettier-ignore -->
```css
a {
transition-property: opacity;
transition: opacity 1s linear;
}
```
<!-- prettier-ignore -->
```css
a {
-webkit-transition-property: opacity;
-webkit-transition: opacity 1s linear;
}
```
<!-- prettier-ignore -->
```css
a {
border-top-width: 1px;
top: 0;
bottom: 3px;
border: 2px solid blue;
}
```
The following patterns are _not_ considered violations:
<!-- prettier-ignore -->
```css
a { padding: 10px; padding-left: 20px; }
```
<!-- prettier-ignore -->
```css
a { transition-property: opacity; } a { transition: opacity 1s linear; }
```
<!-- prettier-ignore -->
```css
a { transition-property: opacity; -webkit-transition: opacity 1s linear; }
```
@@ -0,0 +1,61 @@
// @ts-nocheck
'use strict';
const eachDeclarationBlock = require('../../utils/eachDeclarationBlock');
const report = require('../../utils/report');
const ruleMessages = require('../../utils/ruleMessages');
const shorthandData = require('../../reference/shorthandData');
const validateOptions = require('../../utils/validateOptions');
const vendor = require('../../utils/vendor');
const ruleName = 'declaration-block-no-shorthand-property-overrides';
const messages = ruleMessages(ruleName, {
rejected: (shorthand, original) => `Unexpected shorthand "${shorthand}" after "${original}"`,
});
function rule(actual) {
return (root, result) => {
const validOptions = validateOptions(result, ruleName, { actual });
if (!validOptions) {
return;
}
eachDeclarationBlock(root, (eachDecl) => {
const declarations = {};
eachDecl((decl) => {
const prop = decl.prop;
const unprefixedProp = vendor.unprefixed(prop);
const prefix = vendor.prefix(prop).toLowerCase();
const overrideables = shorthandData[unprefixedProp.toLowerCase()];
if (!overrideables) {
declarations[prop.toLowerCase()] = prop;
return;
}
overrideables.forEach((longhandProp) => {
if (!Object.prototype.hasOwnProperty.call(declarations, prefix + longhandProp)) {
return;
}
report({
ruleName,
result,
node: decl,
message: messages.rejected(prop, declarations[prefix + longhandProp]),
});
});
});
});
};
}
rule.ruleName = ruleName;
rule.messages = messages;
module.exports = rule;