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
@@ -0,0 +1,147 @@
# declaration-block-semicolon-space-after
Require a single space or disallow whitespace after the semicolons of declaration blocks.
<!-- prettier-ignore -->
```css
a { color: pink; top: 0; }
/** ↑
* The space after this semicolon */
```
This rule ignores:
- semicolons that are preceded by Less mixins
- the last semicolon of declaration blocks
Use the `block-closing-brace-*-before` rules to control the whitespace between the last semicolon and the closing brace instead.
The [`fix` option](../../../docs/user-guide/usage/options.md#fix) can automatically fix all of the problems reported by this rule.
## Options
`string`: `"always"|"never"|"always-single-line"|"never-single-line"`
### `"always"`
There _must always_ be a single space after the semicolon.
The following patterns are considered violations:
<!-- prettier-ignore -->
```css
a { color: pink;top: 0; }
```
<!-- prettier-ignore -->
```css
a {
color: pink;
top: 0;
}
```
The following patterns are _not_ considered violations:
<!-- prettier-ignore -->
```css
a { color: pink;}
```
<!-- prettier-ignore -->
```css
a { color: pink; }
```
<!-- prettier-ignore -->
```css
a { color: pink; top: 0; }
```
### `"never"`
There _must never_ be whitespace after the semicolon.
The following patterns are considered violations:
<!-- prettier-ignore -->
```css
a { color: pink; top: 0; }
```
<!-- prettier-ignore -->
```css
a {
color: pink;
top: 0;
}
```
The following patterns are _not_ considered violations:
<!-- prettier-ignore -->
```css
a { color: pink;}
```
<!-- prettier-ignore -->
```css
a { color: pink; }
```
<!-- prettier-ignore -->
```css
a { color: pink;top: 0; }
```
### `"always-single-line"`
There _must always_ be a single space after the semicolon in single-line declaration blocks.
The following patterns are considered violations:
<!-- prettier-ignore -->
```css
a { color: pink;top: 0; }
```
The following patterns are _not_ considered violations:
<!-- prettier-ignore -->
```css
a { color: pink; top: 0; }
```
<!-- prettier-ignore -->
```css
a {
color: pink;
top: 0;
}
```
### `"never-single-line"`
There _must never_ be whitespace after the semicolon in single-line declaration blocks.
The following patterns are considered violations:
<!-- prettier-ignore -->
```css
a { color: pink; top: 0; }
```
The following patterns are _not_ considered violations:
<!-- prettier-ignore -->
```css
a { color: pink;top: 0; }
```
<!-- prettier-ignore -->
```css
a {
color: pink;
top: 0;
}
```
@@ -0,0 +1,84 @@
// @ts-nocheck
'use strict';
const blockString = require('../../utils/blockString');
const rawNodeString = require('../../utils/rawNodeString');
const report = require('../../utils/report');
const ruleMessages = require('../../utils/ruleMessages');
const validateOptions = require('../../utils/validateOptions');
const whitespaceChecker = require('../../utils/whitespaceChecker');
const ruleName = 'declaration-block-semicolon-space-after';
const messages = ruleMessages(ruleName, {
expectedAfter: () => 'Expected single space after ";"',
rejectedAfter: () => 'Unexpected whitespace after ";"',
expectedAfterSingleLine: () =>
'Expected single space after ";" in a single-line declaration block',
rejectedAfterSingleLine: () =>
'Unexpected whitespace after ";" in a single-line declaration block',
});
function rule(expectation, options, context) {
const checker = whitespaceChecker('space', expectation, messages);
return function (root, result) {
const validOptions = validateOptions(result, ruleName, {
actual: expectation,
possible: ['always', 'never', 'always-single-line', 'never-single-line'],
});
if (!validOptions) {
return;
}
root.walkDecls((decl) => {
// Ignore last declaration if there's no trailing semicolon
const parentRule = decl.parent;
if (!parentRule.raws.semicolon && parentRule.last === decl) {
return;
}
const nextDecl = decl.next();
if (!nextDecl) {
return;
}
checker.after({
source: rawNodeString(nextDecl),
index: -1,
lineCheckStr: blockString(parentRule),
err: (m) => {
if (context.fix) {
if (expectation.startsWith('always')) {
nextDecl.raws.before = ' ';
return;
}
if (expectation.startsWith('never')) {
nextDecl.raws.before = '';
return;
}
}
report({
message: m,
node: decl,
index: decl.toString().length + 1,
result,
ruleName,
});
},
});
});
};
}
rule.ruleName = ruleName;
rule.messages = messages;
module.exports = rule;