Merge branch 'next' of github.com:prettier/prettier into next

# Conflicts:
#	package.json
#	yarn.lock
This commit is contained in:
fisker Cheung committed 2021-09-08 12:54:17 +08:00
commit beba6fa88c
64 files changed
+3958 -963

No files matched your search

+1
View File
@@ -5,6 +5,7 @@ on:
branches:
- main
- patch-release
- next
pull_request:
jobs:
+1
View File
@@ -5,6 +5,7 @@ on:
branches:
- main
- patch-release
- next
pull_request:
jobs:
+1
View File
@@ -5,6 +5,7 @@ on:
branches:
- main
- patch-release
- next
pull_request:
jobs:
+41
View File
@@ -0,0 +1,41 @@
#### [BREAKING] Add the pure `css` parser (#7933, #9092, #9093 by @fisker)
Previously, when `--parser=css` was passed, Prettier tried to parse the content using `postcss-scss` and `postcss-less`. This caused confusion, and made syntax errors difficult to spot. Now `--parser=css` works only with the vanilla CSS syntax.
_If you use `parser="css"` for your `.less`/`.scss` files, update it to the correct parser or remove the `parser` option to let Prettier auto-detect the parser by the file extension._
<!-- prettier-ignore -->
```less
/* Input */
/* Less Syntax with `--parser=css` */
a {.bordered();}
/* Prettier stable */
/* Less Syntax with `--parser=css` */
a {
.bordered();
}
/* Prettier main */
SyntaxError: (postcss) CssSyntaxError Unknown word (2:4)
1 | /* Less Syntax with `--parser=css` */
> 2 | a {.bordered();}
```
<!-- prettier-ignore -->
```scss
/* Input */
/* Scss Syntax with `--parser=css` */
::before {content: #{$foo}}
/* Prettier stable */
/* Scss Syntax with `--parser=css` */
::before {
content: #{$foo};
}
/* Prettier main */
SyntaxError: (postcss) CssSyntaxError Unknown word (2:22)
1 | /* Scss Syntax with `--parser=css` */
> 2 | ::before {content: #{$foo}}
```
+16
View File
@@ -0,0 +1,16 @@
#### Fix interpolation parse error (#11343 by @fisker)
<!-- prettier-ignore -->
```less
// Input
@{selector}-title{ @{prop}-size: @{color} }
// Prettier stable
SyntaxError: CssSyntaxError: Unknown word (1:20)
> 1 | @{selector}-title{ @{prop}-size: @{color} }
// Prettier main
@{selector}-title {
@{prop}-size: @{color};
}
```
+1
View File
@@ -58,6 +58,7 @@
"codemirror",
"codemod",
"codemods",
"colorette",
"combinator",
"commonmark",
"compat",
+3 -3
View File
@@ -259,9 +259,9 @@ Valid options:
- `"typescript"` (via [@typescript-eslint/typescript-estree](https://github.com/typescript-eslint/typescript-eslint)) _First available in v1.4.0_
- `"espree"` (via [espree](https://github.com/eslint/espree)) _First available in v2.2.0_
- `"meriyah"` (via [meriyah](https://github.com/meriyah/meriyah)) _First available in v2.2.0_
- `"css"` (via [postcss-scss](https://github.com/postcss/postcss-scss) and [postcss-less](https://github.com/shellscape/postcss-less), autodetects which to use) _First available in v1.7.1_
- `"scss"` (same parsers as `"css"`, prefers postcss-scss) _First available in v1.7.1_
- `"less"` (same parsers as `"css"`, prefers postcss-less) _First available in v1.7.1_
- `"css"` (via [postcss](https://github.com/postcss/postcss)) _First available in v1.7.1_
- `"scss"` (via [postcss-scss](https://github.com/postcss/postcss-scss)) _First available in v1.7.1_
- `"less"` (via [postcss-less](https://github.com/shellscape/postcss-less) _First available in v1.7.1_
- `"json"` (via [@babel/parser parseExpression](https://babeljs.io/docs/en/next/babel-parser.html#babelparserparseexpressioncode-options)) _First available in v1.5.0_
- `"json5"` (same parser as `"json"`, but outputs as [json5](https://json5.org/)) _First available in v1.13.0_
- `"json-stringify"` (same parser as `"json"`, but outputs like `JSON.stringify`) _First available in v1.13.0_
+4 -5
View File
@@ -66,9 +66,10 @@
"outdent": "0.8.0",
"parse-srcset": "ikatyang/parse-srcset#54eb9c1cb21db5c62b4d0e275d7249516df6f0ee",
"please-upgrade-node": "3.2.0",
"postcss-less": "3.1.4",
"postcss": "8.3.6",
"postcss-less": "5.0.0",
"postcss-media-query-parser": "0.2.3",
"postcss-scss": "2.1.1",
"postcss-scss": "4.0.0",
"postcss-selector-parser": "2.2.3",
"postcss-values-parser": "2.0.1",
"regexp-util": "1.2.2",
@@ -134,9 +135,7 @@
"rollup-plugin-terser": "7.0.2",
"shelljs": "0.8.4",
"snapshot-diff": "0.9.0",
"tempy": "1.0.1",
"terser-webpack-plugin": "5.2.3",
"webpack": "5.49.0"
"tempy": "1.0.1"
},
"scripts": {
"prepublishOnly": "echo \"Error: must publish from dist/\" && exit 1",
+34 -106
View File
@@ -1,7 +1,5 @@
import path from "node:path";
import fs from "node:fs";
import { rollup } from "rollup";
import webpack from "webpack";
import { nodeResolve as rollupPluginNodeResolve } from "@rollup/plugin-node-resolve";
import rollupPluginAlias from "@rollup/plugin-alias";
import rollupPluginCommonjs from "@rollup/plugin-commonjs";
@@ -10,7 +8,6 @@ import rollupPluginJson from "@rollup/plugin-json";
import rollupPluginReplace from "@rollup/plugin-replace";
import { terser as rollupPluginTerser } from "rollup-plugin-terser";
import { babel as rollupPluginBabel } from "@rollup/plugin-babel";
import WebpackPluginTerser from "terser-webpack-plugin";
import createEsmUtils from "esm-utils";
import builtinModules from "builtin-modules";
import rollupPluginExecutable from "./rollup-plugins/executable.mjs";
@@ -44,29 +41,38 @@ const entries = [
find: "@glimmer/syntax",
replacement: require.resolve("@glimmer/syntax"),
},
// https://github.com/rollup/plugins/issues/670
{
find: "is-core-module",
replacement: require.resolve("is-core-module"),
},
{
find: "yaml/util",
replacement: require.resolve("yaml/util"),
},
// `postcss-less`
{
find: "postcss/lib/input",
replacement: require.resolve("postcss/lib/input"),
},
{
find: "postcss/lib/parser",
replacement: require.resolve("postcss/lib/parser"),
},
{
find: "postcss/lib/comment",
replacement: require.resolve("postcss/lib/comment"),
},
{
find: "postcss/lib/stringifier",
replacement: require.resolve("postcss/lib/stringifier"),
},
{
find: "postcss/lib/tokenize",
replacement: require.resolve("postcss/lib/tokenize"),
},
];
function webpackNativeShims(config, modules) {
if (!config.resolve) {
config.resolve = {};
}
const { resolve } = config;
resolve.alias = resolve.alias || {};
resolve.fallback = resolve.fallback || {};
for (const module of modules) {
if (module in resolve.alias || module in resolve.fallback) {
throw new Error(`fallback/alias for "${module}" already exists.`);
}
const file = path.join(__dirname, `shims/${module}.mjs`);
if (fs.existsSync(file)) {
resolve.alias[module] = file;
} else {
resolve.fallback[module] = false;
}
}
return config;
}
function getBabelConfig(bundle) {
const config = {
babelrc: false,
@@ -271,7 +277,7 @@ function getRollupOutputOptions(bundle, buildOptions) {
if (bundle.target === "node") {
options.format = "cjs";
} else if (bundle.target === "universal") {
if (!bundle.format && bundle.bundler !== "webpack") {
if (!bundle.format) {
return [
{
...options,
@@ -287,86 +293,12 @@ function getRollupOutputOptions(bundle, buildOptions) {
options.format = bundle.format;
}
if (buildOptions.playground && bundle.bundler !== "webpack") {
if (buildOptions.playground) {
return { skipped: true };
}
return [options];
}
function getWebpackConfig(bundle) {
if (bundle.type !== "plugin" || bundle.target !== "universal") {
throw new Error("Must use rollup for this bundle");
}
const config = {
mode: "production",
performance: { hints: false },
entry: path.resolve(PROJECT_ROOT, bundle.input),
module: {
rules: [
{
test: /\.js$/,
use: {
loader: "babel-loader",
options: getBabelConfig(bundle),
},
},
],
},
output: {
path: path.resolve(PROJECT_ROOT, "dist"),
filename: bundle.output,
library: {
type: "umd",
name: bundle.name.split("."),
},
// https://github.com/webpack/webpack/issues/6642
globalObject: 'new Function("return this")()',
},
optimization: {},
resolve: {
// Webpack@5 can't resolve "postcss/lib/parser" and "postcss/lib/stringifier"" imported by `postcss-scss`
// Ignore `exports` field to fix bundle script
exportsFields: [],
},
};
if (bundle.terserOptions) {
config.optimization.minimizer = [
new WebpackPluginTerser(bundle.terserOptions),
];
}
// config.optimization.minimize = false;
return webpackNativeShims(config, ["os", "path", "util", "url", "fs"]);
}
function runWebpack(config) {
return new Promise((resolve, reject) => {
webpack(config, (error, stats) => {
if (error) {
reject(error);
return;
}
if (stats.hasErrors()) {
const { errors } = stats.toJson();
const error = new Error(errors[0].message);
error.errors = errors;
reject(error);
return;
}
if (stats.hasWarnings()) {
const { warnings } = stats.toJson();
console.warn(warnings);
}
resolve();
});
});
}
async function createBundle(bundle, cache, options) {
const inputOptions = getRollupConfig(bundle);
const outputOptions = getRollupOutputOptions(bundle, options);
@@ -388,12 +320,8 @@ async function createBundle(bundle, cache, options) {
return { cached: true };
}
if (bundle.bundler === "webpack") {
await runWebpack(getWebpackConfig(bundle));
} else {
const result = await rollup(inputOptions);
await Promise.all(outputOptions.map((option) => result.write(option)));
}
const result = await rollup(inputOptions);
await Promise.all(outputOptions.map((option) => result.write(option)));
return { bundled: true };
}
+11 -21
View File
@@ -7,7 +7,6 @@ import path from "node:path";
* @property {string?} name - name for the UMD bundle (for plugins, it'll be `prettierPlugins.${name}`)
* @property {'node' | 'universal'} target - should generate a CJS only for node or universal bundle
* @property {'core' | 'plugin'} type - it's a plugin bundle or core part of prettier
* @property {'rollup' | 'webpack'} [bundler='rollup'] - define which bundler to use
* @property {CommonJSConfig} [commonjs={}] - options for `rollup-plugin-commonjs`
* @property {string[]} external - array of paths that should not be included in the final bundle
* @property {Object.<string, string | {code: string}>} replaceModule - module replacement path or code
@@ -65,29 +64,20 @@ const parsers = [
},
{
input: "src/language-css/parser-postcss.js",
// postcss has dependency cycles that don't work with rollup
bundler: "webpack",
terserOptions: {
// prevent terser generate extra .LICENSE file
extractComments: false,
terserOptions: {
// prevent U+FFFE in the output
output: {
ascii_only: true,
},
mangle: {
// postcss need keep_fnames when minify
keep_fnames: true,
// we don't transform class anymore, so we need keep_classnames too
keep_classnames: true,
},
mangle: {
// postcss need keep_fnames when minify
keep_fnames: true,
// we don't transform class anymore, so we need keep_classnames too
keep_classnames: true,
},
},
},
{
input: "dist/parser-postcss.js",
output: "esm/parser-postcss.mjs",
format: "esm",
replace: {
// `colorette`
'"NO_COLOR" in process.env': "true",
},
// TODO[@fisker]: Enable minify
minify: false,
},
{
input: "src/language-graphql/parser-graphql.js",
-1
View File
@@ -1,3 +1,2 @@
export const existsSync = () => false;
export const readFileSync = () => "";
export default { existsSync, readFileSync };
-1
View File
@@ -1,2 +1 @@
export * from "path-browserify";
export { default } from "path-browserify";
+3
View File
@@ -93,6 +93,9 @@ function clean(ast, newObj, parent) {
if (ast.type === "value-number") {
newObj.unit = newObj.unit.toLowerCase();
}
if (ast.type === "value-unknown") {
newObj.value = newObj.value.replace(/;$/g, "");
}
if (
(ast.type === "media-feature" ||
+42 -7
View File
@@ -1,28 +1,63 @@
"use strict";
const lineColumnToIndex = require("../utils/line-column-to-index.js");
const { getLast, skipEverythingButNewLine } = require("../common/util.js");
const {
getLast,
skipEverythingButNewLine,
isNonEmptyArray,
} = require("../common/util.js");
function calculateLocStart(node, text) {
// `postcss>=8`
if (
node.source &&
node.source.start &&
typeof node.source.start.offset === "number"
) {
return node.source.start.offset;
}
// value-* nodes have this
if (typeof node.sourceIndex === "number") {
return node.sourceIndex;
}
return node.source ? lineColumnToIndex(node.source.start, text) - 1 : null;
if (node.source && node.source.start) {
return lineColumnToIndex(node.source.start, text);
}
/* istanbul ignore next */
// eslint-disable-next-line no-console
console.log(node);
/* istanbul ignore next */
throw new Error("Can not locate node.");
}
function calculateLocEnd(node, text) {
if (node.type === "css-comment" && node.inline) {
return skipEverythingButNewLine(text, node.source.startOffset);
}
const endNode = node.nodes && getLast(node.nodes);
if (endNode && node.source && !node.source.end) {
node = endNode;
// `postcss>=8`
if (
node.source &&
node.source.end &&
typeof node.source.end.offset === "number"
) {
// https://github.com/postcss/postcss/issues/1450
return node.source.end.offset + 1;
}
if (node.source && node.source.end) {
return lineColumnToIndex(node.source.end, text);
if (node.source) {
if (node.source.end) {
return lineColumnToIndex(node.source.end, text);
}
if (isNonEmptyArray(node.nodes)) {
return calculateLocEnd(getLast(node.nodes), text);
}
}
return null;
}
+72 -28
View File
@@ -7,8 +7,6 @@ const { hasPragma } = require("./pragma.js");
const {
hasSCSSInterpolation,
hasStringOrFunction,
isLessParser,
isSCSS,
isSCSSNestedPropertyNode,
isSCSSVariable,
stringifyNode,
@@ -43,7 +41,7 @@ function parseValueNode(valueNode, options) {
const node = nodes[i];
if (
isSCSS(options.parser, node.value) &&
options.parser === "scss" &&
node.type === "number" &&
node.unit === ".." &&
getLast(node.value) === "."
@@ -83,7 +81,8 @@ function parseValueNode(valueNode, options) {
// Stringify if the value parser can't handle the content.
if (
hasSCSSInterpolation(groupList) ||
(!hasStringOrFunction(groupList) && !isSCSSVariable(groupList[0]))
(!hasStringOrFunction(groupList) &&
!isSCSSVariable(groupList[0], options))
) {
const stringifiedContent = stringifyNode({
groups: node.group.groups,
@@ -303,6 +302,64 @@ function parseNestedCSS(node, options) {
node.raws = {};
}
// Custom properties looks like declarations
if (
node.type === "css-decl" &&
typeof node.prop === "string" &&
node.prop.startsWith("--") &&
typeof node.value === "string" &&
node.value.startsWith("{")
) {
let rules;
if (node.value.endsWith("}")) {
const textBefore = options.originalText.slice(
0,
node.source.start.offset
);
const nodeText =
"a".repeat(node.prop.length) +
options.originalText.slice(
node.source.start.offset + node.prop.length,
node.source.end.offset + 1
);
const fakeContent = textBefore.replace(/[^\n]/g, " ") + nodeText;
let parse;
if (options.parser === "scss") {
parse = parseScss;
} else if (options.parser === "less") {
parse = parseLess;
} else {
parse = parseCss;
}
let ast;
try {
ast = parse(fakeContent, [], { ...options });
} catch {
// noop
}
if (
ast &&
ast.nodes &&
ast.nodes.length === 1 &&
ast.nodes[0].type === "css-rule"
) {
rules = ast.nodes[0].nodes;
}
}
if (rules) {
node.value = {
type: "css-rule",
nodes: rules,
};
} else {
node.value = {
type: "value-unknown",
value: node.raws.value.raw,
};
}
return node;
}
let selector = "";
if (typeof node.selector === "string") {
@@ -373,7 +430,7 @@ function parseNestedCSS(node, options) {
}
// Check on SCSS nested property
if (isSCSSNestedPropertyNode(node)) {
if (isSCSSNestedPropertyNode(node, options)) {
node.isSCSSNesterProperty = true;
}
@@ -416,7 +473,7 @@ function parseNestedCSS(node, options) {
}
if (
isLessParser(options) &&
options.parser === "less" &&
node.type === "css-decl" &&
value.startsWith("extend(")
) {
@@ -433,7 +490,7 @@ function parseNestedCSS(node, options) {
}
if (node.type === "css-atrule") {
if (isLessParser(options)) {
if (options.parser === "less") {
// mixin
if (node.mixin) {
const source =
@@ -463,7 +520,7 @@ function parseNestedCSS(node, options) {
return node;
}
if (isLessParser(options)) {
if (options.parser === "less") {
// postcss-less doesn't recognize variables in some cases.
// `@color: blue;` is recognized fine, but the cases below aren't:
@@ -592,7 +649,10 @@ function parseWithParser(parse, text, options) {
let result;
try {
result = parse(text);
result = parse(text, {
// Prevent file access https://github.com/postcss/postcss/blob/4f4e2932fc97e2c117e1a4b15f0272ed551ed59d/lib/previous-map.js#L18
map: false,
});
} catch (error) {
const { name, reason, line, column } = error;
/* istanbul ignore next */
@@ -602,6 +662,7 @@ function parseWithParser(parse, text, options) {
throw createError(`${name}: ${reason}`, { start: { line, column } });
}
options.originalText = text;
result = parseNestedCSS(addTypePrefix(result, "css-"), options);
calculateLoc(result, text);
@@ -617,26 +678,9 @@ function parseWithParser(parse, text, options) {
return result;
}
// TODO: make this only work on css
function parseCss(text, parsers, options) {
const isSCSSParser = isSCSS(options.parser, text);
const parseFunctions = isSCSSParser
? [parseScss, parseLess]
: [parseLess, parseScss];
let error;
for (const parse of parseFunctions) {
try {
return parse(text, parsers, options);
} catch (parseError) {
error = error || parseError;
}
}
/* istanbul ignore next */
if (error) {
throw error;
}
const { parse } = require("postcss");
return parseWithParser(parse, text, options);
}
function parseLess(text, parsers, options) {
+21 -12
View File
@@ -38,9 +38,7 @@ const {
insideURLFunctionInImportAtRuleNode,
isKeyframeAtRuleKeywords,
isWideKeywords,
isSCSS,
isLastNode,
isLessParser,
isSCSSControlDirectiveNode,
isDetachedRulesetDeclarationNode,
isRelationalOperatorNode,
@@ -123,7 +121,9 @@ function genericPrint(path, options, print) {
node.selector.type === "selector-unknown" &&
lastLineHasInlineComment(node.selector.value)
? line
: " ",
: node.selector
? " "
: "",
"{",
node.nodes.length > 0
? indent([hardline, printNodeSequence(path, options, print)])
@@ -141,6 +141,8 @@ function genericPrint(path, options, print) {
const { between: rawBetween } = node.raws;
const trimmedBetween = rawBetween.trim();
const isColon = trimmedBetween === ":";
const isValueAllSpace =
typeof node.value === "string" && /^ *$/.test(node.value);
let value = hasComposesNode(node)
? removeLines(print("value"))
@@ -155,8 +157,8 @@ function genericPrint(path, options, print) {
insideICSSRuleNode(path) ? node.prop : maybeToLowerCase(node.prop),
trimmedBetween.startsWith("//") ? " " : "",
trimmedBetween,
node.extend ? "" : " ",
isLessParser(options) && node.extend && node.selector
node.extend || isValueAllSpace ? "" : " ",
options.parser === "less" && node.extend && node.selector
? ["extend(", print("selector"), ")"]
: "",
value,
@@ -198,7 +200,7 @@ function genericPrint(path, options, print) {
!parentNode.raws.semicolon &&
options.originalText[locEnd(node) - 1] !== ";";
if (isLessParser(options)) {
if (options.parser === "less") {
if (node.mixin) {
return [
print("selector"),
@@ -237,6 +239,11 @@ function genericPrint(path, options, print) {
];
}
}
const isImportUnknownValueEndsWithSemiColon =
node.name === "import" &&
node.params &&
node.params.type === "value-unknown" &&
node.params.value.endsWith(";");
return [
"@",
@@ -269,7 +276,7 @@ function genericPrint(path, options, print) {
? group([
" ",
print("value"),
isSCSSControlDirectiveNode(node)
isSCSSControlDirectiveNode(node, options)
? hasParensAroundNode(node)
? " "
: line
@@ -280,7 +287,7 @@ function genericPrint(path, options, print) {
: "",
node.nodes
? [
isSCSSControlDirectiveNode(node)
isSCSSControlDirectiveNode(node, options)
? ""
: (node.selector &&
!node.selector.nodes &&
@@ -299,7 +306,8 @@ function genericPrint(path, options, print) {
softline,
"}",
]
: isTemplatePlaceholderNodeWithoutSemiColon
: isTemplatePlaceholderNodeWithoutSemiColon ||
isImportUnknownValueEndsWithSemiColon
? ""
: ";",
];
@@ -521,7 +529,8 @@ function genericPrint(path, options, print) {
declAncestorProp.startsWith("grid-template"));
const atRuleAncestorNode = getAncestorNode(path, "css-atrule");
const isControlDirective =
atRuleAncestorNode && isSCSSControlDirectiveNode(atRuleAncestorNode);
atRuleAncestorNode &&
isSCSSControlDirectiveNode(atRuleAncestorNode, options);
const hasInlineComment = node.groups.some((node) =>
isInlineValueCommentNode(node)
);
@@ -854,7 +863,7 @@ function genericPrint(path, options, print) {
return group(indent(fill(res)));
}
const isSCSSMapItem = isSCSSMapItemNode(path);
const isSCSSMapItem = isSCSSMapItemNode(path, options);
const lastItem = getLast(node.groups);
const isLastItemComment = lastItem && lastItem.type === "value-comment";
@@ -892,7 +901,7 @@ function genericPrint(path, options, print) {
]),
ifBreak(
!isLastItemComment &&
isSCSS(options.parser, options.originalText) &&
options.parser === "scss" &&
isSCSSMapItem &&
shouldPrintComma(options)
? ","
+19 -20
View File
@@ -87,16 +87,13 @@ function hasStringOrFunction(groupList) {
return false;
}
function isSCSS(parser, text) {
const hasExplicitParserChoice = parser === "less" || parser === "scss";
const IS_POSSIBLY_SCSS = /(\w\s*:\s*[^:}]+|#){|@import[^\n]+(?:url|,)/;
return hasExplicitParserChoice
? parser === "scss"
: IS_POSSIBLY_SCSS.test(text);
}
function isSCSSVariable(node) {
return Boolean(node && node.type === "word" && node.value.startsWith("$"));
function isSCSSVariable(node, options) {
return (
options.parser === "scss" &&
node &&
node.type === "word" &&
node.value.startsWith("$")
);
}
function isWideKeywords(value) {
@@ -259,14 +256,19 @@ function isRelationalOperatorNode(node) {
);
}
function isSCSSControlDirectiveNode(node) {
function isSCSSControlDirectiveNode(node, options) {
return (
options.parser === "scss" &&
node.type === "css-atrule" &&
["if", "else", "for", "each", "while"].includes(node.name)
);
}
function isSCSSNestedPropertyNode(node) {
function isSCSSNestedPropertyNode(node, options) {
if (options.parser !== "scss") {
return false;
}
/* istanbul ignore next */
if (!node.selector) {
return false;
@@ -344,7 +346,11 @@ function isKeyValuePairInParenGroupNode(node) {
);
}
function isSCSSMapItemNode(path) {
function isSCSSMapItemNode(path, options) {
if (options.parser !== "scss") {
return false;
}
const node = path.getValue();
// Ignore empty item (i.e. `$key: ()`)
@@ -433,11 +439,6 @@ function isColorAdjusterFuncNode(node) {
return colorAdjusterFunctions.has(node.value.toLowerCase());
}
// TODO: only check `less` when we don't use `less` to parse `css`
function isLessParser(options) {
return options.parser === "css" || options.parser === "less";
}
function lastLineHasInlineComment(text) {
return /\/\//.test(text.split(/[\n\r]/).pop());
}
@@ -492,10 +493,8 @@ module.exports = {
insideURLFunctionInImportAtRuleNode,
isKeyframeAtRuleKeywords,
isWideKeywords,
isSCSS,
isSCSSVariable,
isLastNode,
isLessParser,
isSCSSControlDirectiveNode,
isDetachedRulesetDeclarationNode,
isRelationalOperatorNode,
@@ -1173,28 +1173,23 @@ h3
@each $animal in ((puma), (sea-slug), (egret), (salamander)) {
}
@each $animal, $color, $cursor in (puma, black, default),
(sea-slug, blue, pointer), (egret, white, move)
{
(sea-slug, blue, pointer), (egret, white, move) {
}
@each $animal, $color, $cursor in (puma, black, default),
(sea-slug, blue, pointer), (egret, white, move)
{
(sea-slug, blue, pointer), (egret, white, move) {
}
@each $animal, $color, $cursor in (puma, black, default),
(sea-slug, blue, pointer), (egret, white, move)
{
(sea-slug, blue, pointer), (egret, white, move) {
}
@each $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var
in puma,
sea-slug, egret, salamander
{
sea-slug, egret, salamander {
}
@each $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var,
$very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var1,
$very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var-2
in (puma, black, default),
(sea-slug, blue, pointer), (egret, white, move)
{
(sea-slug, blue, pointer), (egret, white, move) {
}
@each $element, $size in (h1: 20px, h2: 16px, h3: 14px) {
}
@@ -1765,45 +1760,41 @@ through
@for $i from 1 through 8 {
}
@for $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var
from 1
through 5
{
from 1 through 5 {
}
@for $i
from $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var1
through 5
{
@for $i from
$very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var1
through 5 {
}
@for $i
from 1
through $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var-2
{
@for $i from 1 through
$very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var-2 {
}
@for $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var
from $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var1
through $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var-2
{
from
$very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var1
through
$very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var-2 {
}
@for $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var
from $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var1
end $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var-2
{
from
$very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var1
end
$very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var-2 {
}
@for $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var
from ($var1 + $var1)
through ($var-2 + $var-2)
{
from ($var1 + $var1) through ($var-2 + $var-2) {
}
@for $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var
from (
from
(
$very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var1 +
$very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var1
)
through (
through
(
$very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var-2 +
$very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var-2
)
{
) {
}
================================================================================
@@ -2133,7 +2124,7 @@ p {
color: red;
} @else if $type == monster {
color: green;
} @else {
} @else {
color: black;
}
@if $type == ocean {
@@ -2157,64 +2148,36 @@ p {
@if $type == ocean {
} @else if $type == matador {
}
@if $very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-variables ==
$very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-variables
{
@if $very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-variables
==
$very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-variables {
color: blue;
} @else if
$very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-variables ==
$very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-variables
{
==
$very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-variables {
color: red;
} @else if
$very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-variables ==
$very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-variables
{
==
$very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-variables {
color: green;
} @else {
} @else {
color: black;
}
@if $very-very-very-long-var == 0 and $very-very-very-long-var == 0 {
}
@if $very-very-very-very-very-very-long-var ==
0 and
$very-very-very-long-var ==
0
{
@if $very-very-very-very-very-very-long-var == 0 and $very-very-very-long-var
== 0 {
}
@if $very-very-very-very-very-very-very-very-very-very-very-long-var ==
0 and
$very-very-very-very-very-very-very-very-very-very-very-long-var ==
0
{
@if $very-very-very-very-very-very-very-very-very-very-very-long-var == 0 and
$very-very-very-very-very-very-very-very-very-very-very-long-var == 0 {
}
@if $base-font-size !=
16px or
$base-line-height !=
24px or
$base-unit !=
"em" or
$h1-font-size !=
2 *
$base-font-size or
$h2-font-size !=
1.5 *
$base-font-size or
$h3-font-size !=
1.17 *
$base-font-size or
$h4-font-size !=
1 *
$base-font-size or
$h5-font-size !=
0.83 *
$base-font-size or
$h6-font-size !=
0.67 *
$base-font-size or
$indent-amount !=
40px
{
@if $base-font-size != 16px or $base-line-height != 24px or $base-unit != "em"
or $h1-font-size != 2 * $base-font-size or $h2-font-size != 1.5 *
$base-font-size or $h3-font-size != 1.17 * $base-font-size or $h4-font-size
!= 1 * $base-font-size or $h5-font-size != 0.83 * $base-font-size or
$h6-font-size != 0.67 * $base-font-size or $indent-amount != 40px {
}
@if (str-slice($item, 0, 1) == ":") {
}
@@ -2222,7 +2185,7 @@ p {
}
@if ($type == ocean) {
} @else if ($type == matador) {
} @else {
} @else {
}
}
@@ -2582,22 +2545,19 @@ a {
a {
@include section-type-1(
$header: (
margin: 0 0 $margin-base,
text-align: left,
),
$header: (margin: 0 0 $margin-base, text-align: left),
$decoration: (
type: base,
margin: 0 auto -1px 0,
primary-color: $brand-primary,
secondary-color: $gray-light,
secondary-color: $gray-light
),
$title: (
margin: 0 0 $margin-small,
color: false,
font-size: $font-size-h3,
font-weight: false,
line-height: $line-height-h3,
line-height: $line-height-h3
)
);
}
@@ -2605,19 +2565,14 @@ a {
a {
@include item-spotlight-properties-transition(
"-title",
(
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15),
)
(box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15))
);
}
a {
@include item-spotlight-properties-transition(
"-title",
(
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15),
border-color: $brand-primary,
)
(box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15), border-color: $brand-primary)
);
}
@@ -2627,7 +2582,7 @@ a {
(
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15),
border-color:
$very-very-very-very-very-very-very-very-very-very-very-very-very-long-value,
$very-very-very-very-very-very-very-very-very-very-very-very-very-long-value
)
);
}
@@ -4818,17 +4773,15 @@ $i
}
@while ($i > 0) {
}
@while $very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var >
1
{
@while $very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var
> 1 {
}
@while 1 >
$very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var
{
$very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var {
}
@while $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var >
$other-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var
{
@while $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var
>
$other-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var {
}
@while (($i) > (0)) {
}
@@ -4852,12 +4805,13 @@ $i
) {
}
@while (
$very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var >
1
$very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var
> 1
) {
}
@while (
$very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var >
$very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var
>
$other-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var
) {
}
@@ -304,6 +304,44 @@ printWidth: 80
================================================================================
`;
exports[`custom-properties.css format 1`] = `
====================================options=====================================
parsers: ["css"]
printWidth: 80
| printWidth
=====================================input======================================
/* comment 1 */
:root {
/* comment 2 */
--prop : {
/* comment 3 */
color/* comment 4 */: /* comment 5 */#fff/* comment 6 */;/* comment 7 */
/* comment 8 */
font-size: 12px;
/* comment 9 */
};
/* comment 10 */
}
/* comment 11 */
=====================================output=====================================
/* comment 1 */
:root {
/* comment 2 */
--prop: {
/* comment 3 */
color/* comment 4 */: /* comment 5 */ #fff /* comment 6 */; /* comment 7 */
/* comment 8 */
font-size: 12px;
/* comment 9 */
};
/* comment 10 */
}
/* comment 11 */
================================================================================
`;
exports[`declaration.css format 1`] = `
====================================options=====================================
parsers: ["css"]
@@ -887,11 +925,11 @@ article /* comment 168 */ :--heading /* comment 169 */ + /* comment 170 */ p /*
/* custom properties set & @apply rule */
:root {
/* comments 192 */
--centered /* comments 193 */ : /* comments 194 */ {
--centered/* comments 193 */ : /* comments 194 */ {
display: flex;
align-items: center;
justify-content: center;
}
};
}
================================================================================
@@ -0,0 +1,13 @@
/* comment 1 */
:root {
/* comment 2 */
--prop : {
/* comment 3 */
color/* comment 4 */: /* comment 5 */#fff/* comment 6 */;/* comment 7 */
/* comment 8 */
font-size: 12px;
/* comment 9 */
};
/* comment 10 */
}
/* comment 11 */
@@ -107,7 +107,7 @@ printWidth: 80
.validUnquotedUrlsThatAreParsedBySass {
background: url($foo);
background: url($foo + $bar);
background: url($foo+$bar);
background: url($foo*3);
background: url($foo/$bar);
}
@@ -0,0 +1,71 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`empty-props.css format 1`] = `
====================================options=====================================
parsers: ["css"]
printWidth: 80
| printWidth
=====================================input======================================
:root {
--empty:;
--one-space: ;
--two-space: ;
--many-space: ;
}
=====================================output=====================================
:root {
--empty:;
--one-space: ;
--two-space: ;
--many-space: ;
}
================================================================================
`;
exports[`test.css format 1`] = `
====================================options=====================================
parsers: ["css"]
printWidth: 80
| printWidth
=====================================input======================================
/*
This test is copied from \`postcss@8\` release note
https://github.com/postcss/postcss/releases/tag/8.0.0
*/
:root {
--empty: ;
--JSON: [1, "2", {"three": {"a":1}}, [4]];
--javascript: function(rule) { console.log(rule) };
}
@supports (--element(".minwidth", { "minWidth": 300 })) {
[--self] {
background: greenyellow;
}
}
=====================================output=====================================
/*
This test is copied from \`postcss@8\` release note
https://github.com/postcss/postcss/releases/tag/8.0.0
*/
:root {
--empty: ;
--JSON: [1, "2", {"three": {"a": 1}}, [4]];
--javascript: function(rule) {console.log(rule)};
}
@supports (--element(".minwidth", {"minWidth": 300})) {
[--self] {
background: greenyellow;
}
}
================================================================================
`;
@@ -0,0 +1,6 @@
:root {
--empty:;
--one-space: ;
--two-space: ;
--many-space: ;
}
@@ -0,0 +1 @@
run_spec(__dirname, ["css"]);
@@ -0,0 +1,17 @@
/*
This test is copied from `postcss@8` release note
https://github.com/postcss/postcss/releases/tag/8.0.0
*/
:root {
--empty: ;
--JSON: [1, "2", {"three": {"a":1}}, [4]];
--javascript: function(rule) { console.log(rule) };
}
@supports (--element(".minwidth", { "minWidth": 300 })) {
[--self] {
background: greenyellow;
}
}
@@ -1,5 +1,79 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`apply-rule.css format 1`] = `
====================================options=====================================
parsers: ["css"]
printWidth: 80
| printWidth
=====================================input======================================
/* http://tabatkins.github.io/specs/css-apply-rule/#defining */
:root {
--toolbar-theme: {
background-color: hsl(120, 70%, 95%);
border-radius: 4px;
border: 1px solid var(--theme-color late);
};
--toolbar-title-theme: {
color: green;
};
}
:root {
--without-semi: {color:red;}
}
:root {
--like-a-apply-rule: {
color:red;} /* no semi here*/
--another-prop: blue;
}
:root {
--like-a-apply-rule: {
color:red;} /* no semi here*/
--another-one-like-a-apply-rule: {
color:red;
};
}
=====================================output=====================================
/* http://tabatkins.github.io/specs/css-apply-rule/#defining */
:root {
--toolbar-theme: {
background-color: hsl(120, 70%, 95%);
border-radius: 4px;
border: 1px solid var(--theme-color late);
};
--toolbar-title-theme: {
color: green;
};
}
:root {
--without-semi: {
color: red;
};
}
:root {
--like-a-apply-rule: {
color:red;} /* no semi here*/
--another-prop: blue;
}
:root {
--like-a-apply-rule: {
color:red;} /* no semi here*/
--another-one-like-a-apply-rule: {
color:red;
};
}
================================================================================
`;
exports[`variables.css format 1`] = `
====================================options=====================================
parsers: ["css"]
+30
View File
@@ -0,0 +1,30 @@
/* http://tabatkins.github.io/specs/css-apply-rule/#defining */
:root {
--toolbar-theme: {
background-color: hsl(120, 70%, 95%);
border-radius: 4px;
border: 1px solid var(--theme-color late);
};
--toolbar-title-theme: {
color: green;
};
}
:root {
--without-semi: {color:red;}
}
:root {
--like-a-apply-rule: {
color:red;} /* no semi here*/
--another-prop: blue;
}
:root {
--like-a-apply-rule: {
color:red;} /* no semi here*/
--another-one-like-a-apply-rule: {
color:red;
};
}
@@ -407,6 +407,35 @@ foo {
================================================================================
`;
exports[`selectors.less format 1`] = `
====================================options=====================================
parsers: ["less"]
printWidth: 80
| printWidth
=====================================input======================================
/* custom properties set & @apply rule */
:root {
/* comments 192 */ --centered /* comments 193 */ : /* comments 194 */ {
display: flex;
align-items: center;
justify-content: center;
};
}
=====================================output=====================================
/* custom properties set & @apply rule */
:root {
/* comments 192 */
--centered/* comments 193 */ : /* comments 194 */ {
display: flex;
align-items: center;
justify-content: center;
};
}
================================================================================
`;
exports[`trailing_star_slash.less format 1`] = `
====================================options=====================================
parsers: ["less"]
@@ -0,0 +1,8 @@
/* custom properties set & @apply rule */
:root {
/* comments 192 */ --centered /* comments 193 */ : /* comments 194 */ {
display: flex;
align-items: center;
justify-content: center;
};
}
@@ -0,0 +1,75 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`apply-rule.less format 1`] = `
====================================options=====================================
parsers: ["less"]
printWidth: 80
| printWidth
=====================================input======================================
/* http://tabatkins.github.io/specs/css-apply-rule/#defining */
:root {
--toolbar-theme: {
background-color: hsl(120, 70%, 95%);
border-radius: 4px;
border: 1px solid var(--theme-color late);
};
--toolbar-title-theme: {
color: green;
};
}
:root {
--without-semi: {color:red;}
}
:root {
--like-a-apply-rule: {
color:red;} /* no semi here*/
--another-prop: blue;
}
:root {
--like-a-apply-rule: {
color:red;} /* no semi here*/
--another-one-like-a-apply-rule: {
color:red;
};
}
=====================================output=====================================
/* http://tabatkins.github.io/specs/css-apply-rule/#defining */
:root {
--toolbar-theme: {
background-color: hsl(120, 70%, 95%);
border-radius: 4px;
border: 1px solid var(--theme-color late);
};
--toolbar-title-theme: {
color: green;
};
}
:root {
--without-semi: {
color: red;
};
}
:root {
--like-a-apply-rule: {
color:red;} /* no semi here*/
--another-prop: blue;
}
:root {
--like-a-apply-rule: {
color:red;} /* no semi here*/
--another-one-like-a-apply-rule: {
color:red;
};
}
================================================================================
`;
@@ -0,0 +1,30 @@
/* http://tabatkins.github.io/specs/css-apply-rule/#defining */
:root {
--toolbar-theme: {
background-color: hsl(120, 70%, 95%);
border-radius: 4px;
border: 1px solid var(--theme-color late);
};
--toolbar-title-theme: {
color: green;
};
}
:root {
--without-semi: {color:red;}
}
:root {
--like-a-apply-rule: {
color:red;} /* no semi here*/
--another-prop: blue;
}
:root {
--like-a-apply-rule: {
color:red;} /* no semi here*/
--another-one-like-a-apply-rule: {
color:red;
};
}
@@ -0,0 +1 @@
run_spec(__dirname, ["less"]);
@@ -0,0 +1,19 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`interpolation.less format 1`] = `
====================================options=====================================
parsers: ["less"]
printWidth: 80
| printWidth
=====================================input======================================
// https://github.com/shellscape/postcss-less/pull/159
@{selector}-title{ @{prop}-size: @{color} }
=====================================output=====================================
// https://github.com/shellscape/postcss-less/pull/159
@{selector}-title {
@{prop}-size: @{color};
}
================================================================================
`;
@@ -0,0 +1,2 @@
// https://github.com/shellscape/postcss-less/pull/159
@{selector}-title{ @{prop}-size: @{color} }
@@ -0,0 +1 @@
run_spec(__dirname, ["less"]);
@@ -0,0 +1,71 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`empty-props.less format 1`] = `
====================================options=====================================
parsers: ["less"]
printWidth: 80
| printWidth
=====================================input======================================
:root {
--empty:;
--one-space: ;
--two-space: ;
--many-space: ;
}
=====================================output=====================================
:root {
--empty:;
--one-space: ;
--two-space: ;
--many-space: ;
}
================================================================================
`;
exports[`test.less format 1`] = `
====================================options=====================================
parsers: ["less"]
printWidth: 80
| printWidth
=====================================input======================================
/*
This test is copied from \`postcss@8\` release note
https://github.com/postcss/postcss/releases/tag/8.0.0
*/
:root {
--empty: ;
--JSON: [1, "2", {"three": {"a":1}}, [4]];
--javascript: function(rule) { console.log(rule) };
}
@supports (--element(".minwidth", { "minWidth": 300 })) {
[--self] {
background: greenyellow;
}
}
=====================================output=====================================
/*
This test is copied from \`postcss@8\` release note
https://github.com/postcss/postcss/releases/tag/8.0.0
*/
:root {
--empty: ;
--JSON: [1, "2", {"three": {"a": 1}}, [4]];
--javascript: function(rule) {console.log(rule)};
}
@supports (--element(".minwidth", {"minWidth": 300})) {
[--self] {
background: greenyellow;
}
}
================================================================================
`;
@@ -0,0 +1,6 @@
:root {
--empty:;
--one-space: ;
--two-space: ;
--many-space: ;
}
@@ -0,0 +1 @@
run_spec(__dirname, ["less"]);
@@ -0,0 +1,17 @@
/*
This test is copied from `postcss@8` release note
https://github.com/postcss/postcss/releases/tag/8.0.0
*/
:root {
--empty: ;
--JSON: [1, "2", {"three": {"a":1}}, [4]];
--javascript: function(rule) { console.log(rule) };
}
@supports (--element(".minwidth", { "minWidth": 300 })) {
[--self] {
background: greenyellow;
}
}
@@ -0,0 +1,15 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`less-syntax.css [css] format 1`] = `
"CssSyntaxError: Unknown word (1:4)
> 1 | a {.bordered();}
| ^
2 |"
`;
exports[`scss-syntax.css [css] format 1`] = `
"CssSyntaxError: Unknown word (1:15)
> 1 | a {content: #{$foo}}
| ^
2 |"
`;
@@ -0,0 +1 @@
run_spec(__dirname, ["css"]);
@@ -0,0 +1 @@
a {.bordered();}
@@ -0,0 +1 @@
a {content: #{$foo}}
@@ -28,3 +28,10 @@ exports[`open-sigle-quote.less [less] format 1`] = `
3 | }
4 |"
`;
exports[`scss-syntax.scss [less] format 1`] = `
"CssSyntaxError: Unknown word (1:15)
> 1 | a {content: #{$foo}}
| ^
2 |"
`;
@@ -0,0 +1 @@
a {content: #{$foo}}
@@ -0,0 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`less-syntax.less [scss] format 1`] = `
"CssSyntaxError: Unknown word (1:4)
> 1 | a {.bordered();}
| ^
2 |"
`;
@@ -0,0 +1 @@
run_spec(__dirname, ["scss"]);
@@ -0,0 +1 @@
a {.bordered();}
File diff suppressed because it is too large. Load diff
+217
View File
@@ -0,0 +1,217 @@
@each $animal in puma, sea-slug, egret, salamander {}
@each $animal in puma,sea-slug,egret,salamander{}
@each $animal in puma , sea-slug , egret , salamander {}
@each $animal in
puma, sea-slug, egret, salamander {}
@each
$animal
in
puma
,
sea-slug
,
egret
,
salamander
{
}
@each
$animal
in
puma
,
sea-slug
,
egret
,
salamander
{
}
@each
$animal
in
puma
,
sea-slug
,
egret
,
salamander
{
}
@each $animal in ((puma), (sea-slug), (egret), (salamander)) {}
@each $animal in((puma),(sea-slug),(egret),(salamander)){}
@each $animal in ( ( puma ) , ( sea-slug ) , ( egret ) , ( salamander ) ) {}
@each $animal
in ((puma), (sea-slug), (egret), (salamander)) {}
@each
$animal
in (
(puma),
(sea-slug),
(egret),
(salamander)
) { }
@each
$animal
in
(
(
puma
)
,
(
sea-slug
)
,
(
egret
)
,
(
salamander
)
)
{
}
@each
$animal
in
(
(
puma
)
,
(
sea-slug
)
,
(
egret
)
,
(
salamander
)
)
{
}
@each $animal, $color, $cursor in (puma, black, default), (sea-slug, blue, pointer), (egret, white, move) {}
@each $animal,$color,$cursor in (puma,black,default),(sea-slug,blue,pointer),(egret,white,move){}
@each $animal, $color, $cursor in
(puma, black, default),
(sea-slug, blue, pointer),
(egret, white, move) {}
@each $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var in puma, sea-slug, egret, salamander {}
@each $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var, $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var1, $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var-2 in (puma, black, default), (sea-slug, blue, pointer), (egret, white, move) {}
@each $element, $size in (h1: 20px, h2: 16px, h3: 14px) {}
@each $element,$size in(h1:20px,h2:16px,h3:14px){}
@each $element , $size in ( h1 : 20px , h2 : 16px , h3 : 14px ) {}
@each $element,
$size in (h1: 20px, h2: 16px, h3: 14px) {}
@each
$element,
$size
in
(
h1
:
20px
,
h2
:
16px
,
h3
:
14px
)
{
}
@each
$element,
$size
in
(
h1
:
20px
,
h2
:
16px
,
h3
:
14px
)
{
}
@each
$element,
$size
in
(
h1
:
20px
,
h2
:
16px
,
h3
:
14px
)
{
}
+43
View File
@@ -0,0 +1,43 @@
@for $i from 1 through 8 {}
@for $i from 1 through 8{}
@for $i from 1 through 8 {}
@for $i
from
1
through
8
{}
@for
$i
from
1
through
8
{}
@for
$i
from
1
through
8
{}
@for
$i
from
1
through
8
{}
@for $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var from 1 through 5 {}
@for $i from $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var1 through 5 {}
@for $i from 1 through $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var-2 {}
@for $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var from $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var1 through $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var-2 {}
@for $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var from $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var1 end $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var-2 {}
@for $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var from ($var1 + $var1) through ($var-2 + $var-2) {}
@for $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var from ($very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var1 + $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var1) through ($very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var-2 + $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var-2) {}
+145
View File
@@ -0,0 +1,145 @@
@if $media == phonePortrait {
$k: .15625;
} @else if $media == phoneLandscape {
$k: .08803;
} @else if $media == tabletPortrait {
$k: .065106;
}
p {
@if $type == ocean {}
@if $type==ocean{}
@if $type == ocean {}
@if $type
== ocean {}
@if
$type
==
ocean
{
}
@if
$type
==
ocean
{
}
@if (($type) == (ocean)) {}
@if (($type)==(ocean)){}
@if ( ( $type ) == ( ocean ) ) {}
@if (($type)
== (ocean)) {}
@if
(
(
$type
)
==
(
ocean
)
)
{
}
@if
(
(
$type
)
==
(
ocean
)
)
{
}
@if $type == ocean {
color: blue;
} @else if $type == matador {
color: red;
} @else if $type == monster {
color: green;
} @else {
color: black;
}
@if $type == ocean {
} @else if $type == matador {
}
@if $type==ocean{}@else if $type==matador{}
@if $type == ocean { } @else if $type == matador { }
@if $type == ocean {}
@else if $type == matador {}
@if
$type == ocean {}
@else if
$type == matador {}
@if
$type
==
ocean
{
}
@else
if
$type
==
matador
{
}
@if
$type
==
ocean
{
}
@else
if
$type
==
matador
{
}
@if $very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-variables == $very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-variables {
color: blue;
} @else if $very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-variables == $very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-variables {
color: red;
} @else if $very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-variables == $very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-variables {
color: green;
} @else {
color: black;
}
@if $very-very-very-long-var == 0 and $very-very-very-long-var == 0 {}
@if $very-very-very-very-very-very-long-var == 0 and $very-very-very-long-var == 0 {}
@if $very-very-very-very-very-very-very-very-very-very-very-long-var == 0 and $very-very-very-very-very-very-very-very-very-very-very-long-var == 0 {}
@if $base-font-size != 16px or $base-line-height != 24px or $base-unit != 'em' or $h1-font-size != 2 * $base-font-size or $h2-font-size != 1.5 * $base-font-size or $h3-font-size != 1.17 * $base-font-size or $h4-font-size != 1 * $base-font-size or $h5-font-size != 0.83 * $base-font-size or $h6-font-size != 0.67 * $base-font-size or $indent-amount != 40px {}
@if (str-slice($item, 0, 1) == ":") {}
@if (str-slice($item, 0, 3) == " : ") {}
@if ($type == ocean) {} @else if ($type == matador) {} @else {}
}
+119
View File
@@ -0,0 +1,119 @@
@include mix(1px, 2px, $arg2: 10, 2px 4px 6px);
@include mix(1px,2px,$arg2:10,2px 4px 6px);
@include mix ( 1px , 2px , $arg2 : 10 , 2px 4px 6px );
@include mix ( 1px , 2px , $arg2 : 10 , 2px 4px 6px );
@include mix(
1px,
2px,
$arg2: 10,
2px 4px 6px
);
@include
mix(
1px,
2px,
$arg2: 10,
2px 4px 6px
);
@include
mix
(
1px
,
2px
,
$arg2
:
10
,
2px
4px
6px
)
;
@include
mix
(
1px
,
2px
,
$arg2
:
10
,
2px
4px
6px
)
;
@include mix($very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-arg: 1px, $very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-arg1: 2px, $very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-arg2: 10, 2px 4px 6px);
a {
@include global-variable-overriding;
@include mix($very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-arg: 1px, $very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-arg1: 2px, $very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-arg2: 10, 2px 4px 6px);
@include apply-to-ie6-only {}
@include apply-to-ie6-only{}
@include apply-to-ie6-only
{}
@include
apply-to-ie6-only
{
}
@include
apply-to-ie6-only
{
}
}
a {
@include section-type-1(
$header: (margin: 0 0 $margin-base, text-align: left),
$decoration: (type: base, margin: 0 auto -1px 0, primary-color: $brand-primary, secondary-color: $gray-light),
$title: (margin: 0 0 $margin-small, color: false, font-size: $font-size-h3, font-weight: false, line-height: $line-height-h3)
);
}
a {
@include item-spotlight-properties-transition(
"-title",
(box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15))
);
}
a {
@include item-spotlight-properties-transition(
"-title",
(
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15),
border-color: $brand-primary
)
);
}
a {
@include item-spotlight-properties-transition(
"-title",
(
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15),
border-color: $very-very-very-very-very-very-very-very-very-very-very-very-very-long-value
)
);
}
+1
View File
@@ -0,0 +1 @@
run_spec(__dirname, ["scss"]);
+110
View File
@@ -0,0 +1,110 @@
@while $i > 0 {}
@while $i>0{}
@while $i > 0 {}
@while $i
>
0
{}
@while
$i
>
0
{}
@while
$i
>
0
{
}
@while
$i
>
0
{
}
@while ($i > 0) {}
@while ($i>0){}
@while ( $i > 0 ) {}
@while ( $i > 0 ) {}
@while (
$i > 0
) {}
@while
($i > 0) {}
@while
(
$i
>
0
)
{
}
@while
(
$i
>
0
)
{
}
@while $very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var > 1 {}
@while 1 > $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var {}
@while $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var > $other-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var {}
@while (($i) > (0)) {}
@while (($i)>(0)){}
@while ( ( $i ) > ( 0 ) ) {}
@while (($i)
>
(0)
) {}
@while
(
(
$i
)
>
(
0
)
)
{
}
@while
(
(
$i
)
>
(
0
)
)
{
}
@while ($very-very-very-very-very-very-very-very-very-very-very-very-long-var > 1) {}
@while (1 > $very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var) {}
@while ($very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var > 1) {}
@while ($very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var > $other-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-var) {}
@@ -301,6 +301,35 @@ printWidth: 80
================================================================================
`;
exports[`custom-properties.scss format 1`] = `
====================================options=====================================
parsers: ["scss"]
printWidth: 80
| printWidth
=====================================input======================================
/* custom properties set & @apply rule */
:root {
/* comments 192 */ --centered /* comments 193 */ : /* comments 194 */ {
display: flex;
align-items: center;
justify-content: center;
};
}
=====================================output=====================================
/* custom properties set & @apply rule */
:root {
/* comments 192 */
--centered/* comments 193 */ : /* comments 194 */ {
display: flex;
align-items: center;
justify-content: center;
};
}
================================================================================
`;
exports[`if-eslit-at-rule-decloration.scss format 1`] = `
====================================options=====================================
parsers: ["scss"]
@@ -0,0 +1,8 @@
/* custom properties set & @apply rule */
:root {
/* comments 192 */ --centered /* comments 193 */ : /* comments 194 */ {
display: flex;
align-items: center;
justify-content: center;
};
}
@@ -0,0 +1,112 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`inline_url.scss format 1`] = `
====================================options=====================================
parsers: ["scss"]
printWidth: 80
| printWidth
=====================================input======================================
.stringContentIsNotModifiedEvenIfInvalid {
background: url('@images');
background: url("$images");
background: url('/+0PX!/"\\a?~^[]{} $%#');
background: url("/+0PX!/'\\a?~^[]{} $%#");
background: url(
"whitespace-around-string"
);
}
.validUnquotedUrls {
background: url(
whitespace-around-string
);
background-image: url(/images/product/simple_product_manager/breadcrumb/chevron_right.png);
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mO4/B8AAqgB0yr7dJgAAAAASUVORK5CYII=);
background-image: url(data:application/font-woff;charset=utf-8;base64,ThisIsNormalBut/+0ThisIsLowerCased);
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mO4/B8AAqgB0yr7dJgAAAAASUVORK5CYII=) center center no-repeat;
background: url(data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%229%22%20height=%229%22%3E%3Cpath%20d=%22M0%203h3%22%20stroke=%22red%22/%3E%3C/svg%3E);
offset-path: url(#path);
background: url(data/+0ThisShouldNotBeLowerCased);
background: url(https://foo/A*3I8oSY6AKRMAAAAAAAAAAABkARQnAQ);
background: url(https://example.com/some/quite,long,url,with,commas.jpg);
background: url(http://123.example.com);
}
@import url(https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900&display=swap);
.validUnqotedUrlsThatAreParsedByLess {
background: url(@foo);
}
.validUnquotedUrlsThatAreParsedBySass {
background: url($foo);
background: url($foo+$bar);
background: url($foo*3);
background: url($foo/$bar);
}
.invalidUnquotedUrlsButWeParseThemAnyway {
background: url(--var(foo-bar,#dadce0));
-fb-sprite: url(fbglyph:cross-outline, fig-white);
}
.number {
background-image: url(http://123.com);
background: url(path/to/123.jpg);
background: url(#123.foo);
background: no-repeat center/80% url(http://123.com);
background: no-repeat center/80% url(path/to/123.jpg);
background: no-repeat center/80% url(#123.foo);
}
=====================================output=====================================
.stringContentIsNotModifiedEvenIfInvalid {
background: url("@images");
background: url("$images");
background: url('/+0PX!/"\\a?~^[]{} $%#');
background: url("/+0PX!/'\\a?~^[]{} $%#");
background: url("whitespace-around-string");
}
.validUnquotedUrls {
background: url(whitespace-around-string);
background-image: url(/images/product/simple_product_manager/breadcrumb/chevron_right.png);
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mO4/B8AAqgB0yr7dJgAAAAASUVORK5CYII=);
background-image: url(data:application/font-woff;charset=utf-8;base64,ThisIsNormalBut/+0ThisIsLowerCased);
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mO4/B8AAqgB0yr7dJgAAAAASUVORK5CYII=)
center center no-repeat;
background: url(data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%229%22%20height=%229%22%3E%3Cpath%20d=%22M0%203h3%22%20stroke=%22red%22/%3E%3C/svg%3E);
offset-path: url(#path);
background: url(data/+0ThisShouldNotBeLowerCased);
background: url(https://foo/A*3I8oSY6AKRMAAAAAAAAAAABkARQnAQ);
background: url(https://example.com/some/quite,long,url,with,commas.jpg);
background: url(http://123.example.com);
}
@import url(https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900&display=swap);
.validUnqotedUrlsThatAreParsedByLess {
background: url(@foo);
}
.validUnquotedUrlsThatAreParsedBySass {
background: url($foo);
background: url($foo + $bar);
background: url($foo*3);
background: url($foo/$bar);
}
.invalidUnquotedUrlsButWeParseThemAnyway {
background: url(--var(foo-bar, #dadce0));
-fb-sprite: url(fbglyph:cross-outline, fig-white);
}
.number {
background-image: url(http://123.com);
background: url(path/to/123.jpg);
background: url(#123.foo);
background: no-repeat center/80% url(http://123.com);
background: no-repeat center/80% url(path/to/123.jpg);
background: no-repeat center/80% url(#123.foo);
}
================================================================================
`;
@@ -0,0 +1,51 @@
.stringContentIsNotModifiedEvenIfInvalid {
background: url('@images');
background: url("$images");
background: url('/+0PX!/"\a?~^[]{} $%#');
background: url("/+0PX!/'\a?~^[]{} $%#");
background: url(
"whitespace-around-string"
);
}
.validUnquotedUrls {
background: url(
whitespace-around-string
);
background-image: url(/images/product/simple_product_manager/breadcrumb/chevron_right.png);
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mO4/B8AAqgB0yr7dJgAAAAASUVORK5CYII=);
background-image: url(data:application/font-woff;charset=utf-8;base64,ThisIsNormalBut/+0ThisIsLowerCased);
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mO4/B8AAqgB0yr7dJgAAAAASUVORK5CYII=) center center no-repeat;
background: url(data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%229%22%20height=%229%22%3E%3Cpath%20d=%22M0%203h3%22%20stroke=%22red%22/%3E%3C/svg%3E);
offset-path: url(#path);
background: url(data/+0ThisShouldNotBeLowerCased);
background: url(https://foo/A*3I8oSY6AKRMAAAAAAAAAAABkARQnAQ);
background: url(https://example.com/some/quite,long,url,with,commas.jpg);
background: url(http://123.example.com);
}
@import url(https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900&display=swap);
.validUnqotedUrlsThatAreParsedByLess {
background: url(@foo);
}
.validUnquotedUrlsThatAreParsedBySass {
background: url($foo);
background: url($foo+$bar);
background: url($foo*3);
background: url($foo/$bar);
}
.invalidUnquotedUrlsButWeParseThemAnyway {
background: url(--var(foo-bar,#dadce0));
-fb-sprite: url(fbglyph:cross-outline, fig-white);
}
.number {
background-image: url(http://123.com);
background: url(path/to/123.jpg);
background: url(#123.foo);
background: no-repeat center/80% url(http://123.com);
background: no-repeat center/80% url(path/to/123.jpg);
background: no-repeat center/80% url(#123.foo);
}
@@ -0,0 +1 @@
run_spec(__dirname, ["scss"]);
@@ -1,5 +1,125 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`apply-rule.scss format 1`] = `
====================================options=====================================
parsers: ["scss"]
printWidth: 80
| printWidth
=====================================input======================================
/* http://tabatkins.github.io/specs/css-apply-rule/#defining */
:root {
--toolbar-theme: {
background-color: hsl(120, 70%, 95%);
border-radius: 4px;
border: 1px solid var(--theme-color late);
};
--toolbar-title-theme: {
color: green;
};
}
:root {
--without-semi: {color:red;}
}
:root {
--like-a-apply-rule: {
color:red;} /* no semi here*/
--another-prop: blue;
}
:root {
--like-a-apply-rule: {
color:red;} /* no semi here*/
--another-one-like-a-apply-rule: {
color:red;
};
}
=====================================output=====================================
/* http://tabatkins.github.io/specs/css-apply-rule/#defining */
:root {
--toolbar-theme: {
background-color: hsl(120, 70%, 95%);
border-radius: 4px;
border: 1px solid var(--theme-color late);
};
--toolbar-title-theme: {
color: green;
};
}
:root {
--without-semi: {
color: red;
};
}
:root {
--like-a-apply-rule: {
color:red;} /* no semi here*/
--another-prop: blue;
}
:root {
--like-a-apply-rule: {
color:red;} /* no semi here*/
--another-one-like-a-apply-rule: {
color:red;
};
}
================================================================================
`;
exports[`postcss-8-improment.scss format 1`] = `
====================================options=====================================
parsers: ["scss"]
printWidth: 80
| printWidth
=====================================input======================================
/*
This test is copied from \`postcss@8\` release note
https://github.com/postcss/postcss/releases/tag/8.0.0
*/
:root {
--empty: ;
--JSON: [1, "2", {"three": {"a":1}}, [4]];
--javascript: function(rule) { console.log(rule) };
}
@supports (--element(".minwidth", { "minWidth": 300 })) {
[--self] {
background: greenyellow;
}
}
=====================================output=====================================
/*
This test is copied from \`postcss@8\` release note
https://github.com/postcss/postcss/releases/tag/8.0.0
*/
:root {
--empty: ;
--JSON: [1, "2", {"three": {"a": 1}}, [4]];
--javascript: function(rule) {console.log(rule)};
}
@supports (--element(".minwidth", {"minWidth": 300})) {
[--self] {
background: greenyellow;
}
}
================================================================================
`;
exports[`variables.scss format 1`] = `
====================================options=====================================
parsers: ["scss"]
@@ -0,0 +1,30 @@
/* http://tabatkins.github.io/specs/css-apply-rule/#defining */
:root {
--toolbar-theme: {
background-color: hsl(120, 70%, 95%);
border-radius: 4px;
border: 1px solid var(--theme-color late);
};
--toolbar-title-theme: {
color: green;
};
}
:root {
--without-semi: {color:red;}
}
:root {
--like-a-apply-rule: {
color:red;} /* no semi here*/
--another-prop: blue;
}
:root {
--like-a-apply-rule: {
color:red;} /* no semi here*/
--another-one-like-a-apply-rule: {
color:red;
};
}
@@ -0,0 +1,17 @@
/*
This test is copied from `postcss@8` release note
https://github.com/postcss/postcss/releases/tag/8.0.0
*/
:root {
--empty: ;
--JSON: [1, "2", {"three": {"a":1}}, [4]];
--javascript: function(rule) { console.log(rule) };
}
@supports (--element(".minwidth", { "minWidth": 300 })) {
[--self] {
background: greenyellow;
}
}
+966 -650
View File
File diff suppressed because it is too large. Load diff