added all files to project

This commit is contained in:
2022-03-10 10:36:59 +01:00
parent 09dd957b33
commit 46a936d7de
25351 changed files with 3883356 additions and 0 deletions
+70
View File
@@ -0,0 +1,70 @@
# property-no-vendor-prefix
Disallow vendor prefixes for properties.
<!-- prettier-ignore -->
```css
a { -webkit-transform: scale(1); }
/** ↑
* This prefix */
```
This rule does not blanketly condemn vendor prefixes. Instead, it uses [Autoprefixer's](https://github.com/postcss/autoprefixer) up-to-date data (from [caniuse.com](http://caniuse.com/)) to know whether a vendor prefix should cause a violation or not. _If you've included a vendor prefixed property that has a standard alternative, one that Autoprefixer could take care of for you, this rule will complain about it_. If, however, you use a non-standard vendor-prefixed property, one that Autoprefixer would ignore and could not provide (such as `-webkit-touch-callout`), this rule will ignore it.
The [`fix` option](../../../docs/user-guide/usage/options.md#fix) can automatically fix all of the problems reported by this rule.
## Options
### `true`
The following patterns are considered violations:
<!-- prettier-ignore -->
```css
a { -webkit-transform: scale(1); }
```
<!-- prettier-ignore -->
```css
a { -moz-columns: 2; }
```
The following patterns are _not_ considered violations:
<!-- prettier-ignore -->
```css
a { transform: scale(1); }
```
<!-- prettier-ignore -->
```css
a {
columns: 2; }
```
<!-- prettier-ignore -->
```css
a { -webkit-touch-callout: none; }
```
## Optional secondary options
### `ignoreProperties: ["/regex/", /regex/, "string"]`
Given:
```
["transform", "columns"]
```
The following patterns are _not_ considered violations:
<!-- prettier-ignore -->
```css
a { -webkit-transform: scale(1); }
```
<!-- prettier-ignore -->
```css
a { -moz-columns: 2; }
```
+76
View File
@@ -0,0 +1,76 @@
// @ts-nocheck
'use strict';
const _ = require('lodash');
const isAutoprefixable = require('../../utils/isAutoprefixable');
const optionsMatches = require('../../utils/optionsMatches');
const report = require('../../utils/report');
const ruleMessages = require('../../utils/ruleMessages');
const validateOptions = require('../../utils/validateOptions');
const vendor = require('../../utils/vendor');
const ruleName = 'property-no-vendor-prefix';
const messages = ruleMessages(ruleName, {
rejected: (property) => `Unexpected vendor-prefix "${property}"`,
});
function rule(actual, options, context) {
return (root, result) => {
const validOptions = validateOptions(
result,
ruleName,
{ actual },
{
optional: true,
actual: options,
possible: {
ignoreProperties: [_.isString, _.isRegExp],
},
},
);
if (!validOptions) {
return;
}
root.walkDecls((decl) => {
const prop = decl.prop;
const unprefixedProp = vendor.unprefixed(prop);
//return early if property is to be ignored
if (optionsMatches(options, 'ignoreProperties', unprefixedProp)) {
return;
}
// Make sure there's a vendor prefix,
// but this isn't a custom property
if (prop[0] !== '-' || prop[1] === '-') {
return;
}
if (!isAutoprefixable.property(prop)) {
return;
}
if (context.fix) {
decl.prop = isAutoprefixable.unprefix(decl.prop);
return;
}
report({
message: messages.rejected(prop),
node: decl,
result,
ruleName,
});
});
};
}
rule.ruleName = ruleName;
rule.messages = messages;
module.exports = rule;