Merge branch 'next' of github.com:prettier/prettier into next
* 'next' of github.com:prettier/prettier: Optimize some usage of `Array#filter` (#6996) Update `jest` to v24 (#6954) Replace `trim{Left,Right}` with `trim{Start,End}` (#6994) Set `trailingComma` default value to `es5` (#6963) Fix `new` usage for builtin objects (#6968) Replace `indexOf` with `includes` (#6967) fix: tests for empty type parameters in TS (#6960) Fix MDX html parsing errors (#6949) fix: issue #6813 (Zero-based lists are broken) (#6852) Style: use async functions (#6935) Disable trailingComma for Angular internal parser (#6912) Update `snapshot-diff` to v0.6.1 (#6955) Update build scripts to target Node.js 10 (#6908)
This commit is contained in:
commit
ac6c6fad0c
263 files changed
+5358
-4198
No files matched your search
@@ -6,8 +6,11 @@ extends:
|
||||
- eslint:recommended
|
||||
- plugin:react/recommended
|
||||
- plugin:prettier/recommended
|
||||
parserOptions:
|
||||
ecmaVersion: 2017
|
||||
plugins:
|
||||
- import
|
||||
- unicorn
|
||||
rules:
|
||||
curly: error
|
||||
import/no-extraneous-dependencies:
|
||||
@@ -32,3 +35,5 @@ rules:
|
||||
- error
|
||||
- never
|
||||
- exceptRange: true
|
||||
unicorn/new-for-builtins: error
|
||||
unicorn/prefer-includes: error
|
||||
@@ -0,0 +1,19 @@
|
||||
#### Handle zero-based lists correctly ([#6852](https://github.com/prettier/prettier/pull/6852) by [@evilebottnawi](https://github.com/evilebottnawi))
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```md
|
||||
<!-- Input -->
|
||||
0. List
|
||||
1. List
|
||||
2. List
|
||||
|
||||
<!-- Prettier stable -->
|
||||
0. List
|
||||
1. List
|
||||
1. List
|
||||
|
||||
<!-- Prettier master -->
|
||||
0. List
|
||||
1. List
|
||||
2. List
|
||||
```
|
||||
@@ -0,0 +1,43 @@
|
||||
#### Fix MDX html parsing errors ([#6949](https://github.com/prettier/prettier/pull/6949) by [@Tigge](https://github.com/Tigge) & [@thorn0](https://github.com/thorn0))
|
||||
|
||||
MDX parsing for JSX failed when encountering JSX elements that where not
|
||||
parsable as HTML. Such as `<Tag value={{a: 'b'}}>test</Tag>`
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
````md
|
||||
<!-- Input -->
|
||||
|
||||
<Tag value={ {a : 'b' } }>test</ Tag>
|
||||
|
||||
<Foo bg={ 'red' } >
|
||||
<div style={{ display: 'block'} }>
|
||||
<Bar >hi </Bar>
|
||||
{ hello }
|
||||
{ /* another comment */}
|
||||
</div>
|
||||
</Foo>
|
||||
|
||||
<!-- Prettier stable -->
|
||||
|
||||
```
|
||||
SyntaxError: Unexpected closing tag "Tag". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags (1:35)
|
||||
> 1 | <Tag value={ {a : 'b' } }>test</ Tag>
|
||||
| ^
|
||||
2 |
|
||||
3 | <Foo bg={ 'red' } >
|
||||
4 | <div style={{ display: 'block'} }>
|
||||
```
|
||||
|
||||
<!-- Prettier master -->
|
||||
|
||||
<Tag value={{ a: "b" }}>test</Tag>
|
||||
|
||||
<Foo bg={"red"}>
|
||||
<div style={{ display: "block" }}>
|
||||
<Bar>hi </Bar>
|
||||
{hello}
|
||||
{/* another comment */}
|
||||
</div>
|
||||
</Foo>
|
||||
|
||||
````
|
||||
+4
-4
@@ -97,13 +97,13 @@ Print trailing commas wherever possible when multi-line. (A single-line array, f
|
||||
|
||||
Valid options:
|
||||
|
||||
- `"none"` - No trailing commas.
|
||||
- `"es5"` - Trailing commas where valid in ES5 (objects, arrays, etc.)
|
||||
- `"none"` - No trailing commas.
|
||||
- `"all"` - Trailing commas wherever possible (including function arguments). This requires node 8 or a [transform](https://babeljs.io/docs/plugins/syntax-trailing-function-commas/).
|
||||
|
||||
| Default | CLI Override | API Override |
|
||||
| -------- | ------------------------------------------------------ | ------------------------------------------------------ |
|
||||
| `"none"` | <code>--trailing-comma <none|es5|all></code> | <code>trailingComma: "<none|es5|all>"</code> |
|
||||
| Default | CLI Override | API Override |
|
||||
| ------- | ------------------------------------------------------ | ------------------------------------------------------ |
|
||||
| `"es5"` | <code>--trailing-comma <es5|none|all></code> | <code>trailingComma: "<es5|none|all>"</code> |
|
||||
|
||||
## Bracket Spacing
|
||||
|
||||
|
||||
+4
-3
@@ -11,7 +11,7 @@
|
||||
"license": "MIT",
|
||||
"main": "./index.js",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
"node": ">=10"
|
||||
},
|
||||
"dependencies": {
|
||||
"@angular/compiler": "8.2.13",
|
||||
@@ -89,8 +89,9 @@
|
||||
"eslint-plugin-import": "2.18.2",
|
||||
"eslint-plugin-prettier": "3.1.1",
|
||||
"eslint-plugin-react": "7.16.0",
|
||||
"eslint-plugin-unicorn": "13.0.0",
|
||||
"execa": "3.2.0",
|
||||
"jest": "23.3.0",
|
||||
"jest": "24.9.0",
|
||||
"jest-junit": "9.0.0",
|
||||
"jest-snapshot-serializer-ansi": "1.0.0",
|
||||
"jest-snapshot-serializer-raw": "1.1.0",
|
||||
@@ -107,7 +108,7 @@
|
||||
"rollup-plugin-node-resolve": "5.2.0",
|
||||
"rollup-plugin-terser": "5.1.2",
|
||||
"shelljs": "0.8.3",
|
||||
"snapshot-diff": "0.4.0",
|
||||
"snapshot-diff": "0.6.1",
|
||||
"strip-ansi": "5.2.0",
|
||||
"synchronous-promise": "2.0.10",
|
||||
"tempy": "0.2.1",
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
//
|
||||
// BEFORE:
|
||||
// [__something__].includes(__something__)
|
||||
// CONSTANT_CASE.includes(__something__)
|
||||
//
|
||||
// AFTER:
|
||||
// [__something__].indexOf(__something__) !== -1
|
||||
// CONSTANT_CASE.indexOf(__something__) !== -1
|
||||
//
|
||||
|
||||
module.exports = ({ types: t }) => ({
|
||||
visitor: {
|
||||
CallExpression(path) {
|
||||
const node = path.node;
|
||||
const callee = node.callee;
|
||||
if (
|
||||
t.isMemberExpression(callee, { computed: false }) &&
|
||||
(t.isArrayExpression(callee.object) ||
|
||||
(t.isIdentifier(callee.object) &&
|
||||
(/^[A-Z_]+$/.test(callee.object.name) ||
|
||||
// https://github.com/eemeli/yaml/blob/1005d01/src/Anchors.js#L45
|
||||
callee.object.name === "names"))) &&
|
||||
t.isIdentifier(callee.property, { name: "includes" })
|
||||
) {
|
||||
callee.property.name = "indexOf";
|
||||
path.replaceWith(t.binaryExpression("!==", node, t.numericLiteral(-1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -29,7 +29,7 @@ function fitTerminal(input) {
|
||||
const columns = Math.min(process.stdout.columns || 40, 80);
|
||||
const WIDTH = columns - stringWidth(OK) + 1;
|
||||
if (input.length < WIDTH) {
|
||||
input += Array(WIDTH - input.length).join(chalk.dim("."));
|
||||
input += new Array(WIDTH - input.length).join(chalk.dim("."));
|
||||
}
|
||||
return input;
|
||||
}
|
||||
@@ -77,7 +77,6 @@ async function cacheFiles() {
|
||||
async function preparePackage() {
|
||||
const pkg = await util.readJson("package.json");
|
||||
pkg.bin = "./bin-prettier.js";
|
||||
pkg.engines.node = ">=4";
|
||||
delete pkg.dependencies;
|
||||
delete pkg.devDependencies;
|
||||
pkg.scripts = {
|
||||
@@ -99,7 +98,7 @@ async function run(params) {
|
||||
await execa("rm", ["-rf", ".cache"]);
|
||||
}
|
||||
|
||||
const bundleCache = new Cache(".cache/", "v19");
|
||||
const bundleCache = new Cache(".cache/", "v20");
|
||||
await bundleCache.load();
|
||||
|
||||
console.log(chalk.inverse(" Building packages "));
|
||||
|
||||
@@ -47,7 +47,7 @@ function getBabelConfig(bundle) {
|
||||
require.resolve("./babel-plugins/transform-custom-require")
|
||||
);
|
||||
}
|
||||
const targets = { node: 4 };
|
||||
const targets = { node: "10" };
|
||||
if (bundle.target === "universal") {
|
||||
// From https://jamie.build/last-2-versions
|
||||
targets.browsers = [">0.25%", "not ie 11", "not op_mini all"];
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
|
||||
const path = require("path");
|
||||
const PROJECT_ROOT = path.resolve(__dirname, "../..");
|
||||
const babelReplaceArrayIncludesWithIndexof = require.resolve(
|
||||
"./babel-plugins/replace-array-includes-with-indexof"
|
||||
);
|
||||
|
||||
/**
|
||||
* @typedef {Object} Bundle
|
||||
@@ -29,8 +26,7 @@ const babelReplaceArrayIncludesWithIndexof = require.resolve(
|
||||
const parsers = [
|
||||
{
|
||||
input: "src/language-js/parser-babylon.js",
|
||||
target: "universal",
|
||||
babelPlugins: [babelReplaceArrayIncludesWithIndexof]
|
||||
target: "universal"
|
||||
},
|
||||
{
|
||||
input: "src/language-js/parser-flow.js",
|
||||
@@ -40,7 +36,6 @@ const parsers = [
|
||||
{
|
||||
input: "src/language-js/parser-typescript.js",
|
||||
target: "universal",
|
||||
babelPlugins: [babelReplaceArrayIncludesWithIndexof],
|
||||
replace: {
|
||||
'require("@microsoft/typescript-etw")': "undefined"
|
||||
}
|
||||
@@ -130,8 +125,7 @@ const parsers = [
|
||||
replacement: require.resolve("lines-and-columns")
|
||||
}
|
||||
]
|
||||
},
|
||||
babelPlugins: [babelReplaceArrayIncludesWithIndexof]
|
||||
}
|
||||
}
|
||||
].map(parser => {
|
||||
const name = getFileOutput(parser)
|
||||
|
||||
@@ -6,7 +6,7 @@ module.exports = async function() {
|
||||
const status = await execa.stdout("git", ["status", "--porcelain"]);
|
||||
|
||||
if (status) {
|
||||
throw Error(
|
||||
throw new Error(
|
||||
"Uncommitted local changes. " +
|
||||
"Please revert or commit all local changes before making a release."
|
||||
);
|
||||
|
||||
@@ -8,7 +8,7 @@ module.exports = async function({ version }) {
|
||||
|
||||
const builtPkg = await readJson("dist/package.json");
|
||||
if (builtPkg.version !== version) {
|
||||
throw Error(
|
||||
throw new Error(
|
||||
`Expected ${version} in dist/package.json but found ${builtPkg.version}`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ async function install() {
|
||||
|
||||
const status = await execa.stdout("git", ["ls-files", "-m"]);
|
||||
if (status) {
|
||||
throw Error(
|
||||
throw new Error(
|
||||
"The lockfile needs to be updated, commit it before making the release."
|
||||
);
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ const { waitForEnter } = require("../utils");
|
||||
function getBlogPostInfo(version) {
|
||||
const date = new Date();
|
||||
const year = date.getFullYear();
|
||||
const month = new String(date.getMonth() + 1).padStart(2, "0");
|
||||
const day = new String(date.getDate()).padStart(2, "0");
|
||||
const month = String(date.getMonth() + 1).padStart(2, "0");
|
||||
const day = String(date.getDate()).padStart(2, "0");
|
||||
|
||||
return {
|
||||
file: `website/blog/${year}-${month}-${day}-${version}.md`,
|
||||
|
||||
@@ -5,10 +5,12 @@ const semver = require("semver");
|
||||
|
||||
module.exports = async function({ version, previousVersion }) {
|
||||
if (!semver.valid(version)) {
|
||||
throw Error(`Invalid version specified`);
|
||||
throw new Error(`Invalid version specified`);
|
||||
}
|
||||
|
||||
if (!semver.gt(version, previousVersion)) {
|
||||
throw Error(`Version ${chalk.yellow(version)} has already been published`);
|
||||
throw new Error(
|
||||
`Version ${chalk.yellow(version)} has already been published`
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -14,7 +14,7 @@ function fitTerminal(input) {
|
||||
const columns = Math.min(process.stdout.columns, 80);
|
||||
const WIDTH = columns - stringWidth(OK) + 1;
|
||||
if (input.length < WIDTH) {
|
||||
input += Array(WIDTH - input.length).join(chalk.dim("."));
|
||||
input += new Array(WIDTH - input.length).join(chalk.dim("."));
|
||||
}
|
||||
return input;
|
||||
}
|
||||
@@ -38,7 +38,7 @@ function runYarn(script) {
|
||||
script = [script];
|
||||
}
|
||||
return execa("yarn", ["--silent"].concat(script)).catch(error => {
|
||||
throw Error(`\`yarn ${script}\` failed\n${error.stdout}`);
|
||||
throw new Error(`\`yarn ${script}\` failed\n${error.stdout}`);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ function waitForEnter() {
|
||||
process.stdin.pause();
|
||||
resolve();
|
||||
} else if (key.ctrl && key.name === "c") {
|
||||
reject(Error("Process terminated by the user"));
|
||||
reject(new Error("Process terminated by the user"));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
+8
-12
@@ -600,8 +600,7 @@ function createUsage(context) {
|
||||
const lastCategories = constant.categoryOrder.slice(-1);
|
||||
const restCategories = Object.keys(groupedOptions).filter(
|
||||
category =>
|
||||
firstCategories.indexOf(category) === -1 &&
|
||||
lastCategories.indexOf(category) === -1
|
||||
!firstCategories.includes(category) && !lastCategories.includes(category)
|
||||
);
|
||||
const allCategories = firstCategories.concat(restCategories, lastCategories);
|
||||
|
||||
@@ -659,8 +658,7 @@ function createOptionUsageType(option) {
|
||||
return null;
|
||||
case "choice":
|
||||
return `<${option.choices
|
||||
.filter(choice => choice.since !== null)
|
||||
.filter(choice => !choice.deprecated)
|
||||
.filter(choice => !choice.deprecated && choice.since !== null)
|
||||
.map(choice => choice.value)
|
||||
.join("|")}>`;
|
||||
default:
|
||||
@@ -853,14 +851,14 @@ function createMinimistOptions(detailedOptions) {
|
||||
.map(option => [option.name].concat(option.alias || []))
|
||||
.reduce((a, b) => a.concat(b)),
|
||||
default: detailedOptions
|
||||
.filter(option => !option.deprecated)
|
||||
.filter(
|
||||
option =>
|
||||
!option.forwardToApi ||
|
||||
option.name === "plugin" ||
|
||||
option.name === "plugin-search-dir"
|
||||
!option.deprecated &&
|
||||
(!option.forwardToApi ||
|
||||
option.name === "plugin" ||
|
||||
option.name === "plugin-search-dir") &&
|
||||
option.default !== undefined
|
||||
)
|
||||
.filter(option => option.default !== undefined)
|
||||
.reduce(
|
||||
(current, option) =>
|
||||
Object.assign({ [option.name]: option.default }, current),
|
||||
@@ -990,9 +988,7 @@ function updateContextArgv(context, plugins, pluginSearchDirs) {
|
||||
function normalizeContextArgv(context, keys) {
|
||||
const detailedOptions = !keys
|
||||
? context.detailedOptions
|
||||
: context.detailedOptions.filter(
|
||||
option => keys.indexOf(option.name) !== -1
|
||||
);
|
||||
: context.detailedOptions.filter(option => keys.includes(option.name));
|
||||
const argv = !keys ? context.argv : pick(context.argv, keys);
|
||||
|
||||
context.argv = optionsNormalizer.normalizeCliOptions(argv, detailedOptions, {
|
||||
|
||||
@@ -8,11 +8,12 @@ const getFileContentOrNull = require("../utils/get-file-content-or-null");
|
||||
* @param {undefined | string} ignorePath
|
||||
* @param {undefined | boolean} withNodeModules
|
||||
*/
|
||||
function createIgnorer(ignorePath, withNodeModules) {
|
||||
return (!ignorePath
|
||||
? Promise.resolve(null)
|
||||
: getFileContentOrNull(path.resolve(ignorePath))
|
||||
).then(ignoreContent => _createIgnorer(ignoreContent, withNodeModules));
|
||||
async function createIgnorer(ignorePath, withNodeModules) {
|
||||
const ignoreContent = ignorePath
|
||||
? await getFileContentOrNull(path.resolve(ignorePath))
|
||||
: null;
|
||||
|
||||
return _createIgnorer(ignoreContent, withNodeModules);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+11
-14
@@ -19,24 +19,21 @@ const path = require("path");
|
||||
* not an object. A transformation from this array to an object is automatically done
|
||||
* internally by the method wrapper. See withPlugins() in index.js.
|
||||
*/
|
||||
function getFileInfo(filePath, opts) {
|
||||
async function getFileInfo(filePath, opts) {
|
||||
if (typeof filePath !== "string") {
|
||||
return Promise.reject(
|
||||
new TypeError(
|
||||
`expect \`filePath\` to be a string, got \`${typeof filePath}\``
|
||||
)
|
||||
throw new TypeError(
|
||||
`expect \`filePath\` to be a string, got \`${typeof filePath}\``
|
||||
);
|
||||
}
|
||||
|
||||
return createIgnorer(opts.ignorePath, opts.withNodeModules).then(ignorer =>
|
||||
_getFileInfo({
|
||||
ignorer,
|
||||
filePath: normalizeFilePath(filePath, opts.ignorePath),
|
||||
plugins: opts.plugins,
|
||||
resolveConfig: opts.resolveConfig,
|
||||
sync: false
|
||||
})
|
||||
);
|
||||
const ignorer = await createIgnorer(opts.ignorePath, opts.withNodeModules);
|
||||
return _getFileInfo({
|
||||
ignorer,
|
||||
filePath: normalizeFilePath(filePath, opts.ignorePath),
|
||||
plugins: opts.plugins,
|
||||
resolveConfig: opts.resolveConfig,
|
||||
sync: false
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ function skip(chars) {
|
||||
if (!chars.test(c)) {
|
||||
return cursor;
|
||||
}
|
||||
} else if (chars.indexOf(c) === -1) {
|
||||
} else if (!chars.includes(c)) {
|
||||
return cursor;
|
||||
}
|
||||
|
||||
|
||||
@@ -117,11 +117,10 @@ function clearCache() {
|
||||
resolveEditorConfig.clearCache();
|
||||
}
|
||||
|
||||
function resolveConfigFile(filePath) {
|
||||
async function resolveConfigFile(filePath) {
|
||||
const load = getLoadFunction({ sync: false });
|
||||
return load(filePath).then(result => {
|
||||
return result ? result.filepath : null;
|
||||
});
|
||||
const result = await load(filePath);
|
||||
return result ? result.filepath : null;
|
||||
}
|
||||
|
||||
resolveConfigFile.sync = filePath => {
|
||||
|
||||
@@ -63,9 +63,9 @@ function clean(ast, newObj, parent) {
|
||||
if (
|
||||
(ast.type === "value-word" &&
|
||||
((ast.isColor && ast.isHex) ||
|
||||
["initial", "inherit", "unset", "revert"].indexOf(
|
||||
["initial", "inherit", "unset", "revert"].includes(
|
||||
newObj.value.replace().toLowerCase()
|
||||
) !== -1)) ||
|
||||
))) ||
|
||||
ast.type === "media-feature" ||
|
||||
ast.type === "selector-root-invalid" ||
|
||||
ast.type === "selector-pseudo"
|
||||
@@ -140,7 +140,7 @@ function clean(ast, newObj, parent) {
|
||||
if (ast.type === "selector-tag") {
|
||||
const lowercasedValue = ast.value.toLowerCase();
|
||||
|
||||
if (["from", "to"].indexOf(lowercasedValue) !== -1) {
|
||||
if (["from", "to"].includes(lowercasedValue)) {
|
||||
newObj.value = lowercasedValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -442,7 +442,7 @@ function parseNestedCSS(node, options) {
|
||||
"return",
|
||||
"define-mixin",
|
||||
"add-mixin"
|
||||
].indexOf(name) !== -1
|
||||
].includes(name)
|
||||
) {
|
||||
// Remove unnecessary spaces in SCSS variable arguments
|
||||
params = params.replace(/(\$\S+?)\s+?\.\.\./, "$1...");
|
||||
@@ -465,7 +465,7 @@ function parseNestedCSS(node, options) {
|
||||
return node;
|
||||
}
|
||||
|
||||
if (["media", "custom-media"].indexOf(lowercasedName) !== -1) {
|
||||
if (["media", "custom-media"].includes(lowercasedName)) {
|
||||
if (params.includes("#{")) {
|
||||
// Workaround for media at rule with scss interpolation
|
||||
return {
|
||||
|
||||
@@ -118,7 +118,7 @@ function genericPrint(path, options, print) {
|
||||
const rawText = node.raws.text || node.text;
|
||||
// Workaround a bug where the location is off.
|
||||
// https://github.com/postcss/postcss-scss/issues/63
|
||||
if (text.indexOf(rawText) === -1) {
|
||||
if (!text.includes(rawText)) {
|
||||
if (node.raws.inline) {
|
||||
return concat(["// ", rawText]);
|
||||
}
|
||||
@@ -512,7 +512,7 @@ function genericPrint(path, options, print) {
|
||||
// Ignore escape `\`
|
||||
if (
|
||||
iNode.value &&
|
||||
iNode.value.indexOf("\\") !== -1 &&
|
||||
iNode.value.includes("\\") &&
|
||||
iNextNode &&
|
||||
iNextNode.type !== "value-comment"
|
||||
) {
|
||||
@@ -907,7 +907,7 @@ const STRING_REGEX = /(['"])(?:(?!\1)[^\\]|\\[\s\S])*\1/g;
|
||||
const NUMBER_REGEX = /(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?/g;
|
||||
const STANDARD_UNIT_REGEX = /[a-zA-Z]+/g;
|
||||
const WORD_PART_REGEX = /[$@]?[a-zA-Z_\u0080-\uFFFF][\w\-\u0080-\uFFFF]*/g;
|
||||
const ADJUST_NUMBERS_REGEX = RegExp(
|
||||
const ADJUST_NUMBERS_REGEX = new RegExp(
|
||||
STRING_REGEX.source +
|
||||
`|` +
|
||||
`(${WORD_PART_REGEX.source})?` +
|
||||
|
||||
+13
-18
@@ -35,7 +35,7 @@ function getAncestorCounter(path, typeOrTypes) {
|
||||
let ancestorNode;
|
||||
|
||||
while ((ancestorNode = path.getParentNode(++counter))) {
|
||||
if (types.indexOf(ancestorNode.type) !== -1) {
|
||||
if (types.includes(ancestorNode.type)) {
|
||||
return counter;
|
||||
}
|
||||
}
|
||||
@@ -67,9 +67,8 @@ function isSCSS(parser, text) {
|
||||
}
|
||||
|
||||
function isWideKeywords(value) {
|
||||
return (
|
||||
["initial", "inherit", "unset", "revert"].indexOf(value.toLowerCase()) !==
|
||||
-1
|
||||
return ["initial", "inherit", "unset", "revert"].includes(
|
||||
value.toLowerCase()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -79,7 +78,7 @@ function isKeyframeAtRuleKeywords(path, value) {
|
||||
atRuleAncestorNode &&
|
||||
atRuleAncestorNode.name &&
|
||||
atRuleAncestorNode.name.toLowerCase().endsWith("keyframes") &&
|
||||
["from", "to"].indexOf(value.toLowerCase()) !== -1
|
||||
["from", "to"].includes(value.toLowerCase())
|
||||
);
|
||||
}
|
||||
|
||||
@@ -122,7 +121,7 @@ function insideAtRuleNode(path, atRuleNameOrAtRuleNames) {
|
||||
|
||||
return (
|
||||
atRuleAncestorNode &&
|
||||
atRuleNames.indexOf(atRuleAncestorNode.name.toLowerCase()) !== -1
|
||||
atRuleNames.includes(atRuleAncestorNode.name.toLowerCase())
|
||||
);
|
||||
}
|
||||
|
||||
@@ -168,14 +167,13 @@ function isDetachedRulesetDeclarationNode(node) {
|
||||
function isForKeywordNode(node) {
|
||||
return (
|
||||
node.type === "value-word" &&
|
||||
["from", "through", "end"].indexOf(node.value) !== -1
|
||||
["from", "through", "end"].includes(node.value)
|
||||
);
|
||||
}
|
||||
|
||||
function isIfElseKeywordNode(node) {
|
||||
return (
|
||||
node.type === "value-word" &&
|
||||
["and", "or", "not"].indexOf(node.value) !== -1
|
||||
node.type === "value-word" && ["and", "or", "not"].includes(node.value)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -214,20 +212,19 @@ function isMathOperatorNode(node) {
|
||||
}
|
||||
|
||||
function isEqualityOperatorNode(node) {
|
||||
return node.type === "value-word" && ["==", "!="].indexOf(node.value) !== -1;
|
||||
return node.type === "value-word" && ["==", "!="].includes(node.value);
|
||||
}
|
||||
|
||||
function isRelationalOperatorNode(node) {
|
||||
return (
|
||||
node.type === "value-word" &&
|
||||
["<", ">", "<=", ">="].indexOf(node.value) !== -1
|
||||
node.type === "value-word" && ["<", ">", "<=", ">="].includes(node.value)
|
||||
);
|
||||
}
|
||||
|
||||
function isSCSSControlDirectiveNode(node) {
|
||||
return (
|
||||
node.type === "css-atrule" &&
|
||||
["if", "else", "for", "each", "while"].indexOf(node.name) !== -1
|
||||
["if", "else", "for", "each", "while"].includes(node.name)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -363,7 +360,7 @@ function isRightCurlyBraceNode(node) {
|
||||
}
|
||||
|
||||
function isWordNode(node) {
|
||||
return ["value-word", "value-atword"].indexOf(node.type) !== -1;
|
||||
return ["value-word", "value-atword"].includes(node.type);
|
||||
}
|
||||
|
||||
function isColonNode(node) {
|
||||
@@ -371,9 +368,7 @@ function isColonNode(node) {
|
||||
}
|
||||
|
||||
function isMediaAndSupportsKeywords(node) {
|
||||
return (
|
||||
node.value && ["not", "and", "or"].indexOf(node.value.toLowerCase()) !== -1
|
||||
);
|
||||
return node.value && ["not", "and", "or"].includes(node.value.toLowerCase());
|
||||
}
|
||||
|
||||
function isColorAdjusterFuncNode(node) {
|
||||
@@ -381,7 +376,7 @@ function isColorAdjusterFuncNode(node) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return colorAdjusterFunctions.indexOf(node.value.toLowerCase()) !== -1;
|
||||
return colorAdjusterFunctions.includes(node.value.toLowerCase());
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
@@ -653,7 +653,7 @@ function canAttachComment(node) {
|
||||
function printComment(commentPath) {
|
||||
const comment = commentPath.getValue();
|
||||
if (comment.kind === "Comment") {
|
||||
return "#" + comment.value.trimRight();
|
||||
return "#" + comment.value.trimEnd();
|
||||
}
|
||||
|
||||
throw new Error("Not a comment: " + JSON.stringify(comment));
|
||||
|
||||
@@ -68,7 +68,7 @@ function print(path, options, print) {
|
||||
}
|
||||
case "ElementNode": {
|
||||
const tagFirstChar = n.tag[0];
|
||||
const isLocal = n.tag.indexOf(".") !== -1;
|
||||
const isLocal = n.tag.includes(".");
|
||||
const isGlimmerComponent =
|
||||
tagFirstChar.toUpperCase() === tagFirstChar || isLocal;
|
||||
const hasChildren = n.children.length > 0;
|
||||
@@ -79,7 +79,7 @@ function print(path, options, print) {
|
||||
|
||||
const isVoid =
|
||||
(isGlimmerComponent && (!hasChildren || !hasNonWhitespaceChildren)) ||
|
||||
voidTags.indexOf(n.tag) !== -1;
|
||||
voidTags.includes(n.tag);
|
||||
const closeTagForNoBreak = isVoid ? concat([" />", softline]) : ">";
|
||||
const closeTagForBreak = isVoid ? "/>" : ">";
|
||||
const getParams = (path, print) =>
|
||||
@@ -275,7 +275,7 @@ function print(path, options, print) {
|
||||
|
||||
// preserve a space inside of an attribute node where whitespace present,
|
||||
// when next to mustache statement.
|
||||
const inAttrNode = path.stack.indexOf("attributes") >= 0;
|
||||
const inAttrNode = path.stack.includes("attributes");
|
||||
if (inAttrNode) {
|
||||
const parentNode = path.getParentNode(0);
|
||||
const isConcat = parentNode.type === "ConcatStatement";
|
||||
@@ -334,7 +334,7 @@ function print(path, options, print) {
|
||||
);
|
||||
}
|
||||
case "MustacheCommentStatement": {
|
||||
const dashes = n.value.indexOf("}}") > -1 ? "--" : "";
|
||||
const dashes = n.value.includes("}}") ? "--" : "";
|
||||
return concat(["{{!", dashes, n.value, dashes, "}}"]);
|
||||
}
|
||||
case "PathExpression": {
|
||||
|
||||
@@ -631,7 +631,7 @@ function printOpeningTag(path, options, print) {
|
||||
typeof ignoreAttributeData === "boolean"
|
||||
? () => ignoreAttributeData
|
||||
: Array.isArray(ignoreAttributeData)
|
||||
? attr => ignoreAttributeData.indexOf(attr.rawName) !== -1
|
||||
? attr => ignoreAttributeData.includes(attr.rawName)
|
||||
: () => false;
|
||||
return path.map(attrPath => {
|
||||
const attr = attrPath.getValue();
|
||||
|
||||
@@ -62,13 +62,13 @@ function shouldPreserveContent(node, options) {
|
||||
options.parser === "vue" &&
|
||||
node.type === "element" &&
|
||||
node.parent.type === "root" &&
|
||||
[
|
||||
![
|
||||
"template",
|
||||
"style",
|
||||
"script",
|
||||
// vue parser can be used for vue dom template as well, so we should still format top-level <html>
|
||||
"html"
|
||||
].indexOf(node.fullName) === -1
|
||||
].includes(node.fullName)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
@@ -272,7 +272,7 @@ function forceBreakContent(node) {
|
||||
forceBreakChildren(node) ||
|
||||
(node.type === "element" &&
|
||||
node.children.length !== 0 &&
|
||||
(["body", "script", "style"].indexOf(node.name) !== -1 ||
|
||||
(["body", "script", "style"].includes(node.name) ||
|
||||
node.children.some(child => hasNonTextChild(child)))) ||
|
||||
(node.firstChild &&
|
||||
node.firstChild === node.lastChild &&
|
||||
@@ -287,7 +287,7 @@ function forceBreakChildren(node) {
|
||||
return (
|
||||
node.type === "element" &&
|
||||
node.children.length !== 0 &&
|
||||
(["html", "head", "ul", "ol", "select"].indexOf(node.name) !== -1 ||
|
||||
(["html", "head", "ul", "ol", "select"].includes(node.name) ||
|
||||
(node.cssDisplay.startsWith("table") && node.cssDisplay !== "table-cell"))
|
||||
);
|
||||
}
|
||||
@@ -339,7 +339,7 @@ function preferHardlineAsSurroundingSpaces(node) {
|
||||
case "directive":
|
||||
return true;
|
||||
case "element":
|
||||
return ["script", "select"].indexOf(node.name) !== -1;
|
||||
return ["script", "select"].includes(node.name);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -615,7 +615,7 @@ function printHtmlTemplateLiteral(
|
||||
return "``";
|
||||
}
|
||||
|
||||
const placeholderRegex = RegExp(composePlaceholder("(\\d+)"), "g");
|
||||
const placeholderRegex = new RegExp(composePlaceholder("(\\d+)"), "g");
|
||||
|
||||
const contentDoc = mapDoc(
|
||||
stripTrailingHardline(textToDoc(text, { parser })),
|
||||
|
||||
@@ -76,16 +76,17 @@ module.exports = {
|
||||
type: "choice",
|
||||
default: [
|
||||
{ since: "0.0.0", value: false },
|
||||
{ since: "0.19.0", value: "none" }
|
||||
{ since: "0.19.0", value: "none" },
|
||||
{ since: "2.0.0", value: "es5" }
|
||||
],
|
||||
description: "Print trailing commas wherever possible when multi-line.",
|
||||
choices: [
|
||||
{ value: "none", description: "No trailing commas." },
|
||||
{
|
||||
value: "es5",
|
||||
description:
|
||||
"Trailing commas where valid in ES5 (objects, arrays, etc.)"
|
||||
},
|
||||
{ value: "none", description: "No trailing commas." },
|
||||
{
|
||||
value: "all",
|
||||
description:
|
||||
|
||||
@@ -4,7 +4,7 @@ const docblock = require("jest-docblock");
|
||||
|
||||
function hasPragma(text) {
|
||||
const pragmas = Object.keys(docblock.parse(docblock.extract(text)));
|
||||
return pragmas.indexOf("prettier") !== -1 || pragmas.indexOf("format") !== -1;
|
||||
return pragmas.includes("prettier") || pragmas.includes("format");
|
||||
}
|
||||
|
||||
function insertPragma(text) {
|
||||
|
||||
@@ -10,7 +10,8 @@ function preprocess(ast, options) {
|
||||
return Object.assign({}, ast, {
|
||||
type: options.parser.startsWith("__") ? "JsExpressionRoot" : "JsonRoot",
|
||||
node: ast,
|
||||
comments: []
|
||||
comments: [],
|
||||
rootMarker: options.rootMarker
|
||||
});
|
||||
default:
|
||||
return ast;
|
||||
|
||||
@@ -120,6 +120,16 @@ const {
|
||||
let uid = 0;
|
||||
|
||||
function shouldPrintComma(options, level) {
|
||||
// angular does not allow trailing comma
|
||||
if (
|
||||
options.parser === "__ng_interpolation" ||
|
||||
options.parser === "__ng_action" ||
|
||||
options.parser === "__ng_binding" ||
|
||||
options.parser === "__ng_directive"
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
level = level || "es5";
|
||||
|
||||
switch (options.trailingComma) {
|
||||
@@ -231,7 +241,7 @@ function genericPrint(path, options, printPath, args) {
|
||||
const node = path.getValue();
|
||||
if (hasFlowShorthandAnnotationComment(node)) {
|
||||
parts.push(" /*");
|
||||
parts.push(node.trailingComments[0].value.trimLeft());
|
||||
parts.push(node.trailingComments[0].value.trimStart());
|
||||
parts.push("*/");
|
||||
node.trailingComments[0].printed = true;
|
||||
}
|
||||
@@ -3550,7 +3560,7 @@ function printPathNoParens(path, options, print, args) {
|
||||
path.call(print, "node"),
|
||||
!n.node.comments || n.node.comments.length === 0
|
||||
? []
|
||||
: concat([" //", n.node.comments[0].value.trimRight()])
|
||||
: concat([" //", n.node.comments[0].value.trimEnd()])
|
||||
)
|
||||
);
|
||||
case "NGChainedExpression":
|
||||
@@ -3899,11 +3909,11 @@ function printJestEachTemplateLiteral(node, expressions, options) {
|
||||
const correspondingExpression = stringifiedExpressions[i - 1];
|
||||
|
||||
row.cells.push(correspondingExpression);
|
||||
if (correspondingExpression.indexOf("\n") !== -1) {
|
||||
if (correspondingExpression.includes("\n")) {
|
||||
row.hasLineBreak = true;
|
||||
}
|
||||
|
||||
if (node.quasis[i].value.raw.indexOf("\n") !== -1) {
|
||||
if (node.quasis[i].value.raw.includes("\n")) {
|
||||
tableBody.push({ hasLineBreak: false, cells: [] });
|
||||
}
|
||||
}
|
||||
@@ -5388,8 +5398,12 @@ function printJSXElement(path, options, print) {
|
||||
containsMultipleAttributes ||
|
||||
containsMultipleExpressions;
|
||||
|
||||
const isMdxBlock = path.getParentNode().rootMarker === "mdx";
|
||||
|
||||
const rawJsxWhitespace = options.singleQuote ? "{' '}" : '{" "}';
|
||||
const jsxWhitespace = ifBreak(concat([rawJsxWhitespace, softline]), " ");
|
||||
const jsxWhitespace = isMdxBlock
|
||||
? concat([" "])
|
||||
: ifBreak(concat([rawJsxWhitespace, softline]), " ");
|
||||
|
||||
const isFacebookTranslationTag =
|
||||
n.openingElement &&
|
||||
@@ -5404,8 +5418,7 @@ function printJSXElement(path, options, print) {
|
||||
isFacebookTranslationTag
|
||||
);
|
||||
|
||||
const containsText =
|
||||
n.children.filter(child => isMeaningfulJSXText(child)).length > 0;
|
||||
const containsText = n.children.some(child => isMeaningfulJSXText(child));
|
||||
|
||||
// We can end up we multiple whitespace elements with empty string
|
||||
// content between them.
|
||||
@@ -5509,6 +5522,10 @@ function printJSXElement(path, options, print) {
|
||||
? fill(multilineChildren)
|
||||
: group(concat(multilineChildren), { shouldBreak: true });
|
||||
|
||||
if (isMdxBlock) {
|
||||
return content;
|
||||
}
|
||||
|
||||
const multiLineElem = group(
|
||||
concat([
|
||||
openingLines,
|
||||
@@ -5852,16 +5869,16 @@ function shouldHugType(node) {
|
||||
n.type === "TSNullKeyword"
|
||||
).length;
|
||||
|
||||
const objectCount = node.types.filter(
|
||||
const hasObject = node.types.some(
|
||||
n =>
|
||||
n.type === "ObjectTypeAnnotation" ||
|
||||
n.type === "TSTypeLiteral" ||
|
||||
// This is a bit aggressive but captures Array<{x}>
|
||||
n.type === "GenericTypeAnnotation" ||
|
||||
n.type === "TSTypeReference"
|
||||
).length;
|
||||
);
|
||||
|
||||
if (node.types.length - 1 === voidCount && objectCount > 0) {
|
||||
if (node.types.length - 1 === voidCount && hasObject) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -5987,9 +6004,9 @@ function printComment(commentPath, options) {
|
||||
if (
|
||||
options.originalText.slice(options.locStart(comment)).startsWith("#!")
|
||||
) {
|
||||
return "#!" + comment.value.trimRight();
|
||||
return "#!" + comment.value.trimEnd();
|
||||
}
|
||||
return "//" + comment.value.trimRight();
|
||||
return "//" + comment.value.trimEnd();
|
||||
default:
|
||||
throw new Error("Not a comment: " + JSON.stringify(comment));
|
||||
}
|
||||
@@ -6013,8 +6030,8 @@ function printIndentableBlockComment(comment) {
|
||||
hardline,
|
||||
lines.map((line, index) =>
|
||||
index === 0
|
||||
? line.trimRight()
|
||||
: " " + (index < lines.length - 1 ? line.trim() : line.trimLeft())
|
||||
? line.trimEnd()
|
||||
: " " + (index < lines.length - 1 ? line.trim() : line.trimStart())
|
||||
)
|
||||
),
|
||||
"*/"
|
||||
|
||||
@@ -298,7 +298,7 @@ function isSimpleFlowType(node) {
|
||||
|
||||
return (
|
||||
node &&
|
||||
flowTypeAnnotations.indexOf(node.type) !== -1 &&
|
||||
flowTypeAnnotations.includes(node.type) &&
|
||||
!(node.type === "GenericTypeAnnotation" && node.typeParameters)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,10 @@ function embed(path, print, textToDoc, options) {
|
||||
case "importExport":
|
||||
return textToDoc(node.value, { parser: "babel" });
|
||||
case "jsx":
|
||||
return textToDoc(node.value, { parser: "__js_expression" });
|
||||
return textToDoc(`<$>${node.value}</$>`, {
|
||||
parser: "__js_expression",
|
||||
rootMarker: "mdx"
|
||||
});
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -69,7 +72,7 @@ function embed(path, print, textToDoc, options) {
|
||||
const language = supportInfo.languages.find(
|
||||
language =>
|
||||
language.name.toLowerCase() === lang ||
|
||||
(language.aliases && language.aliases.indexOf(lang) !== -1) ||
|
||||
(language.aliases && language.aliases.includes(lang)) ||
|
||||
(language.extensions &&
|
||||
language.extensions.find(ext => ext.substring(1) === lang))
|
||||
);
|
||||
|
||||
@@ -7,7 +7,6 @@ const parseFrontMatter = require("../utils/front-matter");
|
||||
const { mapAst, INLINE_NODE_WRAPPER_TYPES } = require("./utils");
|
||||
const mdx = require("./mdx");
|
||||
const remarkMath = require("remark-math");
|
||||
const htmlParser = require("../language-html/parser-html").parsers.html;
|
||||
|
||||
/**
|
||||
* based on [MDAST](https://github.com/syntax-tree/mdast) with following modifications:
|
||||
@@ -55,34 +54,12 @@ function htmlToJsx() {
|
||||
if (
|
||||
node.type !== "html" ||
|
||||
node.value.match(mdx.COMMENT_REGEX) ||
|
||||
INLINE_NODE_WRAPPER_TYPES.indexOf(parent.type) !== -1
|
||||
INLINE_NODE_WRAPPER_TYPES.includes(parent.type)
|
||||
) {
|
||||
return node;
|
||||
}
|
||||
|
||||
const nodes = htmlParser.parse(node.value).children;
|
||||
|
||||
// find out if there are adjacent JSX elements which should be allowed in mdx alike in markdown
|
||||
if (nodes.length <= 1) {
|
||||
return Object.assign({}, node, { type: "jsx" });
|
||||
}
|
||||
|
||||
return nodes.reduce((newNodes, { sourceSpan: position, type }) => {
|
||||
const value = node.value.slice(
|
||||
position.start.offset,
|
||||
position.end.offset
|
||||
);
|
||||
|
||||
if (value) {
|
||||
newNodes.push({
|
||||
type: type === "element" ? "jsx" : type,
|
||||
value,
|
||||
position
|
||||
});
|
||||
}
|
||||
|
||||
return newNodes;
|
||||
}, []);
|
||||
return Object.assign({}, node, { type: "jsx" });
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,8 @@ function startWithPragma(text) {
|
||||
|
||||
module.exports = {
|
||||
startWithPragma,
|
||||
hasPragma: text => startWithPragma(parseFrontMatter(text).content.trimLeft()),
|
||||
hasPragma: text =>
|
||||
startWithPragma(parseFrontMatter(text).content.trimStart()),
|
||||
insertPragma: text => {
|
||||
const extracted = parseFrontMatter(text);
|
||||
const pragma = `<!-- @${pragmas[0]} -->`;
|
||||
|
||||
@@ -120,10 +120,10 @@ function splitTextIntoSentences(ast, options) {
|
||||
|
||||
if (parentNode.type === "paragraph") {
|
||||
if (index === 0) {
|
||||
value = value.trimLeft();
|
||||
value = value.trimStart();
|
||||
}
|
||||
if (index === parentNode.children.length - 1) {
|
||||
value = value.trimRight();
|
||||
value = value.trimEnd();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ const {
|
||||
} = require("../doc");
|
||||
const {
|
||||
getFencedCodeBlockValue,
|
||||
getOrderedListItemInfo,
|
||||
hasGitDiffFriendlyOrderedList,
|
||||
splitText,
|
||||
punctuationPattern,
|
||||
INLINE_NODE_TYPES,
|
||||
@@ -35,12 +35,7 @@ const { replaceEndOfLineWith } = require("../common/util");
|
||||
|
||||
const TRAILING_HARDLINE_NODES = ["importExport"];
|
||||
const SINGLE_LINE_NODE_TYPES = ["heading", "tableCell", "link"];
|
||||
const SIBLING_NODE_TYPES = [
|
||||
"listItem",
|
||||
"definition",
|
||||
"footnoteDefinition",
|
||||
"jsx"
|
||||
];
|
||||
const SIBLING_NODE_TYPES = ["listItem", "definition", "footnoteDefinition"];
|
||||
|
||||
function genericPrint(path, options, print) {
|
||||
const node = path.getValue();
|
||||
@@ -70,7 +65,7 @@ function genericPrint(path, options, print) {
|
||||
}
|
||||
return concat([
|
||||
normalizeDoc(printRoot(path, options, print)),
|
||||
TRAILING_HARDLINE_NODES.indexOf(getLastDescendantNode(node).type) === -1
|
||||
!TRAILING_HARDLINE_NODES.includes(getLastDescendantNode(node).type)
|
||||
? hardline
|
||||
: ""
|
||||
]);
|
||||
@@ -235,7 +230,7 @@ function genericPrint(path, options, print) {
|
||||
const value =
|
||||
parentNode.type === "root" &&
|
||||
privateUtil.getLast(parentNode.children) === node
|
||||
? node.value.trimRight()
|
||||
? node.value.trimEnd()
|
||||
: node.value;
|
||||
const isHtmlComment = /^<!--[\s\S]*-->$/.test(value);
|
||||
return concat(
|
||||
@@ -251,11 +246,10 @@ function genericPrint(path, options, print) {
|
||||
path.getParentNode()
|
||||
);
|
||||
|
||||
const isGitDiffFriendlyOrderedList =
|
||||
node.ordered &&
|
||||
node.children.length > 1 &&
|
||||
+getOrderedListItemInfo(node.children[1], options.originalText)
|
||||
.numberText === 1;
|
||||
const isGitDiffFriendlyOrderedList = hasGitDiffFriendlyOrderedList(
|
||||
node,
|
||||
options
|
||||
);
|
||||
|
||||
return printChildren(path, options, print, {
|
||||
processor: (childPath, index) => {
|
||||
@@ -488,7 +482,7 @@ function getAncestorCounter(path, typeOrTypes) {
|
||||
let ancestorNode;
|
||||
|
||||
while ((ancestorNode = path.getParentNode(++counter))) {
|
||||
if (types.indexOf(ancestorNode.type) !== -1) {
|
||||
if (types.includes(ancestorNode.type)) {
|
||||
return counter;
|
||||
}
|
||||
}
|
||||
@@ -723,7 +717,7 @@ function printChildren(path, options, print, events) {
|
||||
|
||||
if (
|
||||
lastChildNode &&
|
||||
TRAILING_HARDLINE_NODES.indexOf(lastChildNode.type) !== -1
|
||||
TRAILING_HARDLINE_NODES.includes(lastChildNode.type)
|
||||
) {
|
||||
if (shouldPrePrintTripleHardline(childNode, data)) {
|
||||
parts.push(hardline);
|
||||
@@ -770,55 +764,34 @@ function isPrettierIgnore(node) {
|
||||
return match === null ? false : match[1] ? match[1] : "next";
|
||||
}
|
||||
|
||||
function isInlineNode(node) {
|
||||
return node && INLINE_NODE_TYPES.indexOf(node.type) !== -1;
|
||||
}
|
||||
|
||||
function isEndsWithHardLine(node) {
|
||||
return node && /\n+$/.test(node.value);
|
||||
}
|
||||
|
||||
function last(nodes) {
|
||||
return nodes && nodes[nodes.length - 1];
|
||||
}
|
||||
|
||||
function shouldNotPrePrintHardline(node, { parentNode, parts, prevNode }) {
|
||||
const isFirstNode = parts.length === 0;
|
||||
function shouldNotPrePrintHardline(node, data) {
|
||||
const isFirstNode = data.parts.length === 0;
|
||||
const isInlineNode = INLINE_NODE_TYPES.includes(node.type);
|
||||
|
||||
const isInlineHTML =
|
||||
node.type === "html" &&
|
||||
INLINE_NODE_WRAPPER_TYPES.indexOf(parentNode.type) !== -1;
|
||||
INLINE_NODE_WRAPPER_TYPES.includes(data.parentNode.type);
|
||||
|
||||
const isAfterHardlineNode =
|
||||
prevNode &&
|
||||
(isEndsWithHardLine(prevNode) ||
|
||||
isEndsWithHardLine(last(prevNode.children)));
|
||||
|
||||
return (
|
||||
isFirstNode || isInlineNode(node) || isInlineHTML || isAfterHardlineNode
|
||||
);
|
||||
return isFirstNode || isInlineNode || isInlineHTML;
|
||||
}
|
||||
|
||||
function shouldPrePrintDoubleHardline(node, { parentNode, prevNode }) {
|
||||
const prevNodeType = prevNode && prevNode.type;
|
||||
const nodeType = node.type;
|
||||
function shouldPrePrintDoubleHardline(node, data) {
|
||||
const isSequence = (data.prevNode && data.prevNode.type) === node.type;
|
||||
const isSiblingNode = isSequence && SIBLING_NODE_TYPES.includes(node.type);
|
||||
|
||||
const isSequence = prevNodeType === nodeType;
|
||||
const isSiblingNode =
|
||||
isSequence && SIBLING_NODE_TYPES.indexOf(nodeType) !== -1;
|
||||
const isInTightListItem =
|
||||
data.parentNode.type === "listItem" && !data.parentNode.loose;
|
||||
|
||||
const isInTightListItem = parentNode.type === "listItem" && !parentNode.loose;
|
||||
const isPrevNodeLooseListItem = prevNodeType === "listItem" && prevNode.loose;
|
||||
const isPrevNodePrettierIgnore = isPrettierIgnore(prevNode) === "next";
|
||||
const isPrevNodeLooseListItem =
|
||||
data.prevNode && data.prevNode.type === "listItem" && data.prevNode.loose;
|
||||
|
||||
const isPrevNodePrettierIgnore = isPrettierIgnore(data.prevNode) === "next";
|
||||
|
||||
const isBlockHtmlWithoutBlankLineBetweenPrevHtml =
|
||||
nodeType === "html" &&
|
||||
prevNodeType === "html" &&
|
||||
prevNode.position.end.line + 1 === node.position.start.line;
|
||||
|
||||
const isJsxInlineSibling =
|
||||
(prevNodeType === "jsx" && isInlineNode(node)) ||
|
||||
(nodeType === "jsx" && isInlineNode(prevNode));
|
||||
node.type === "html" &&
|
||||
data.prevNode &&
|
||||
data.prevNode.type === "html" &&
|
||||
data.prevNode.position.end.line + 1 === node.position.start.line;
|
||||
|
||||
return (
|
||||
isPrevNodeLooseListItem ||
|
||||
@@ -826,8 +799,7 @@ function shouldPrePrintDoubleHardline(node, { parentNode, prevNode }) {
|
||||
isSiblingNode ||
|
||||
isInTightListItem ||
|
||||
isPrevNodePrettierIgnore ||
|
||||
isBlockHtmlWithoutBlankLineBetweenPrevHtml ||
|
||||
isJsxInlineSibling
|
||||
isBlockHtmlWithoutBlankLineBetweenPrevHtml
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -162,6 +162,34 @@ function getOrderedListItemInfo(orderListItem, originalText) {
|
||||
return { numberText, marker, leadingSpaces };
|
||||
}
|
||||
|
||||
function hasGitDiffFriendlyOrderedList(node, options) {
|
||||
if (!node.ordered) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (node.children.length < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const firstNumber = Number(
|
||||
getOrderedListItemInfo(node.children[0], options.originalText).numberText
|
||||
);
|
||||
|
||||
const secondNumber = Number(
|
||||
getOrderedListItemInfo(node.children[1], options.originalText).numberText
|
||||
);
|
||||
|
||||
if (firstNumber === 0 && node.children.length > 2) {
|
||||
const thirdNumber = Number(
|
||||
getOrderedListItemInfo(node.children[2], options.originalText).numberText
|
||||
);
|
||||
|
||||
return secondNumber === 1 && thirdNumber === 1;
|
||||
}
|
||||
|
||||
return secondNumber === 1;
|
||||
}
|
||||
|
||||
// workaround for https://github.com/remarkjs/remark/issues/351
|
||||
// leading and trailing newlines are stripped by remark
|
||||
function getFencedCodeBlockValue(node, originalText) {
|
||||
@@ -202,21 +230,11 @@ function mapAst(ast, handler) {
|
||||
return (function preorder(node, index, parentStack) {
|
||||
parentStack = parentStack || [];
|
||||
|
||||
let newNode = handler(node, index, parentStack);
|
||||
if (Array.isArray(newNode)) {
|
||||
return newNode;
|
||||
}
|
||||
|
||||
newNode = Object.assign({}, newNode);
|
||||
const newNode = Object.assign({}, handler(node, index, parentStack));
|
||||
if (newNode.children) {
|
||||
newNode.children = newNode.children.reduce((nodes, child, index) => {
|
||||
let newNodes = preorder(child, index, [newNode].concat(parentStack));
|
||||
if (!Array.isArray(newNodes)) {
|
||||
newNodes = [newNodes];
|
||||
}
|
||||
nodes.push.apply(nodes, newNodes);
|
||||
return nodes;
|
||||
}, []);
|
||||
newNode.children = newNode.children.map((child, index) => {
|
||||
return preorder(child, index, [newNode].concat(parentStack));
|
||||
});
|
||||
}
|
||||
|
||||
return newNode;
|
||||
@@ -229,6 +247,7 @@ module.exports = {
|
||||
punctuationPattern,
|
||||
getFencedCodeBlockValue,
|
||||
getOrderedListItemInfo,
|
||||
hasGitDiffFriendlyOrderedList,
|
||||
INLINE_NODE_TYPES,
|
||||
INLINE_NODE_WRAPPER_TYPES
|
||||
};
|
||||
@@ -670,7 +670,7 @@ function isAbsolutelyPrintedAsSingleLineNode(node, options) {
|
||||
|
||||
switch (options.proseWrap) {
|
||||
case "never":
|
||||
return node.value.indexOf("\n") === -1;
|
||||
return !node.value.includes("\n");
|
||||
case "always":
|
||||
return !/[\n ]/.test(node.value);
|
||||
// istanbul ignore next
|
||||
|
||||
@@ -22,7 +22,7 @@ function isNode(value, types) {
|
||||
return (
|
||||
value &&
|
||||
typeof value.type === "string" &&
|
||||
(!types || types.indexOf(value.type) !== -1)
|
||||
(!types || types.includes(value.type))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -198,8 +198,8 @@ function getFlowScalarLineContents(nodeType, content, options) {
|
||||
: index !== 0 && index !== lineContents.length - 1
|
||||
? lineContent.trim()
|
||||
: index === 0
|
||||
? lineContent.trimRight()
|
||||
: lineContent.trimLeft()
|
||||
? lineContent.trimEnd()
|
||||
: lineContent.trimStart()
|
||||
);
|
||||
|
||||
if (options.proseWrap === "preserve") {
|
||||
|
||||
+6
-6
@@ -60,7 +60,7 @@ function attachComments(text, ast, opts) {
|
||||
comments.attach(astComments, ast, text, opts);
|
||||
}
|
||||
ast.tokens = [];
|
||||
opts.originalText = opts.parser === "yaml" ? text : text.trimRight();
|
||||
opts.originalText = opts.parser === "yaml" ? text : text.trimEnd();
|
||||
return astComments;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ function coreFormat(text, opts, addAlignmentSize) {
|
||||
opts.endOfLine === "lf"
|
||||
? doc
|
||||
: mapDoc(doc, currentDoc =>
|
||||
typeof currentDoc === "string" && currentDoc.indexOf("\n") !== -1
|
||||
typeof currentDoc === "string" && currentDoc.includes("\n")
|
||||
? currentDoc.replace(/\n/g, eol)
|
||||
: currentDoc
|
||||
),
|
||||
@@ -167,7 +167,7 @@ function coreFormat(text, opts, addAlignmentSize) {
|
||||
let cursorOffset = newCursorNodeStart;
|
||||
for (const entry of cursorNodeDiff) {
|
||||
if (entry.removed) {
|
||||
if (entry.value.indexOf(CURSOR) > -1) {
|
||||
if (entry.value.includes(CURSOR)) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@@ -221,7 +221,7 @@ function formatRange(text, opts) {
|
||||
|
||||
// Since the range contracts to avoid trailing whitespace,
|
||||
// we need to remove the newline that was inserted by the `format` call.
|
||||
const rangeTrimmed = rangeResult.formatted.trimRight();
|
||||
const rangeTrimmed = rangeResult.formatted.trimEnd();
|
||||
const rangeLeft = text.slice(0, rangeStart);
|
||||
const rangeRight = text.slice(rangeEnd);
|
||||
|
||||
@@ -293,7 +293,7 @@ function format(text, opts) {
|
||||
const hasRangeEnd = opts.rangeEnd < text.length;
|
||||
|
||||
// get rid of CR/CRLF parsing
|
||||
if (text.indexOf("\r") !== -1) {
|
||||
if (text.includes("\r")) {
|
||||
const offsetKeys = [
|
||||
hasCursor && "cursorOffset",
|
||||
hasRangeStart && "rangeStart",
|
||||
@@ -372,7 +372,7 @@ module.exports = {
|
||||
|
||||
parse(text, opts, massage) {
|
||||
opts = normalizeOptions(opts);
|
||||
if (text.indexOf("\r") !== -1) {
|
||||
if (text.includes("\r")) {
|
||||
text = text.replace(/\r\n?/g, "\n");
|
||||
}
|
||||
const parsed = parser.parse(text, opts);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
function massageAST(ast, options, parent) {
|
||||
if (Array.isArray(ast)) {
|
||||
return ast.map(e => massageAST(e, options, parent)).filter(e => e);
|
||||
return ast.map(e => massageAST(e, options, parent)).filter(Boolean);
|
||||
}
|
||||
|
||||
if (!ast || typeof ast !== "object") {
|
||||
|
||||
@@ -26,7 +26,7 @@ class FlagSchema extends vnopts.ChoiceSchema {
|
||||
if (
|
||||
typeof value === "string" &&
|
||||
value.length !== 0 &&
|
||||
this._flags.indexOf(value) === -1
|
||||
!this._flags.includes(value)
|
||||
) {
|
||||
const suggestion = this._flags.find(flag => leven(flag, value) < 3);
|
||||
if (suggestion) {
|
||||
@@ -57,7 +57,7 @@ function normalizeOptions(
|
||||
? vnopts.levenUnknownHandler
|
||||
: Array.isArray(passThrough)
|
||||
? (key, value) =>
|
||||
passThrough.indexOf(key) === -1 ? undefined : { [key]: value }
|
||||
!passThrough.includes(key) ? undefined : { [key]: value }
|
||||
: (key, value) => ({ [key]: value });
|
||||
|
||||
const descriptor = isCLI ? cliDescriptor : vnopts.apiDescriptor;
|
||||
|
||||
+2
-2
@@ -176,9 +176,9 @@ function inferParser(filepath, plugins) {
|
||||
language.extensions.some(extension => filename.endsWith(extension))) ||
|
||||
(language.filenames &&
|
||||
language.filenames.find(name => name.toLowerCase() === filename)) ||
|
||||
(filename.indexOf(".") === -1 &&
|
||||
(!filename.includes(".") &&
|
||||
language.interpreters &&
|
||||
language.interpreters.indexOf(getInterpreter(filepath)) !== -1))
|
||||
language.interpreters.includes(getInterpreter(filepath))))
|
||||
);
|
||||
|
||||
return language && language.parsers[0];
|
||||
|
||||
@@ -138,11 +138,11 @@ function isSourceElement(opts, node) {
|
||||
case "flow":
|
||||
case "babel":
|
||||
case "typescript":
|
||||
return jsSourceElements.indexOf(node.type) > -1;
|
||||
return jsSourceElements.includes(node.type);
|
||||
case "json":
|
||||
return jsonSourceElements.indexOf(node.type) > -1;
|
||||
return jsonSourceElements.includes(node.type);
|
||||
case "graphql":
|
||||
return graphqlSourceElements.indexOf(node.kind) > -1;
|
||||
return graphqlSourceElements.includes(node.kind);
|
||||
case "vue":
|
||||
return node.tag !== "root";
|
||||
}
|
||||
|
||||
+3
-5
@@ -36,8 +36,7 @@ function getSupportInfo(version, opts) {
|
||||
"name"
|
||||
)
|
||||
.sort((a, b) => (a.name === b.name ? 0 : a.name < b.name ? -1 : 1))
|
||||
.filter(filterSince)
|
||||
.filter(filterDeprecated)
|
||||
.filter(option => filterSince(option) && filterDeprecated(option))
|
||||
.map(mapDeprecated)
|
||||
.map(mapInternal)
|
||||
.map(option => {
|
||||
@@ -56,8 +55,7 @@ function getSupportInfo(version, opts) {
|
||||
|
||||
if (Array.isArray(newOption.choices)) {
|
||||
newOption.choices = newOption.choices
|
||||
.filter(filterSince)
|
||||
.filter(filterDeprecated)
|
||||
.filter(option => filterSince(option) && filterDeprecated(option))
|
||||
.map(mapDeprecated);
|
||||
}
|
||||
|
||||
@@ -96,7 +94,7 @@ function getSupportInfo(version, opts) {
|
||||
}
|
||||
|
||||
// "babylon" was renamed to "babel" in 1.16.0
|
||||
if (useBabylonParser && language.parsers.indexOf("babel") !== -1) {
|
||||
if (useBabylonParser && language.parsers.includes("babel")) {
|
||||
return Object.assign({}, language, {
|
||||
parsers: language.parsers.map(parser =>
|
||||
parser === "babel" ? "babylon" : parser
|
||||
|
||||
@@ -4,6 +4,7 @@ exports[`test.component.ts 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
printWidth: 80
|
||||
trailingComma: "none"
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
@Component({
|
||||
@@ -52,7 +53,6 @@ exports[`test.component.ts 2`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
printWidth: 80
|
||||
trailingComma: "es5"
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
@Component({
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
run_spec(__dirname, ["typescript"], { trailingComma: "none" });
|
||||
run_spec(__dirname, ["typescript"]);
|
||||
run_spec(__dirname, ["typescript"], { trailingComma: "es5" });
|
||||
@@ -3,6 +3,27 @@
|
||||
exports[`logical-expression.ng 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["__ng_interpolation"]
|
||||
printWidth: 80
|
||||
trailingComma: "none"
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
[
|
||||
advancedSearchService.patientInformationFieldsRow2 && advancedSearchService.patientInformationFieldsRow2.indexOf(advancedSearchService.formElementData.customFieldList[i].customFieldType) !== -1
|
||||
]
|
||||
|
||||
=====================================output=====================================
|
||||
[
|
||||
advancedSearchService.patientInformationFieldsRow2 &&
|
||||
advancedSearchService.patientInformationFieldsRow2.indexOf(
|
||||
advancedSearchService.formElementData.customFieldList[i].customFieldType
|
||||
) !== -1
|
||||
]
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`logical-expression.ng 2`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["__ng_interpolation"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
@@ -20,9 +41,97 @@ printWidth: 80
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`logical-expression.ng 3`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["__ng_interpolation"]
|
||||
printWidth: 80
|
||||
trailingComma: "all"
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
[
|
||||
advancedSearchService.patientInformationFieldsRow2 && advancedSearchService.patientInformationFieldsRow2.indexOf(advancedSearchService.formElementData.customFieldList[i].customFieldType) !== -1
|
||||
]
|
||||
|
||||
=====================================output=====================================
|
||||
[
|
||||
advancedSearchService.patientInformationFieldsRow2 &&
|
||||
advancedSearchService.patientInformationFieldsRow2.indexOf(
|
||||
advancedSearchService.formElementData.customFieldList[i].customFieldType
|
||||
) !== -1
|
||||
]
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`pipe-expression.ng 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["__ng_interpolation"]
|
||||
printWidth: 80
|
||||
trailingComma: "none"
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
[
|
||||
a ? (b | c : d) : (e | f : g),
|
||||
a | b | c | d,
|
||||
((a | b) | c) | d,
|
||||
a | b:(c | d),
|
||||
{ a: b | c },
|
||||
(a + b) | c,
|
||||
(a | b) + c,
|
||||
fn(a | b),
|
||||
a?.b(c | d),
|
||||
a[b | c],
|
||||
($students | async).items,
|
||||
($students | async)(),
|
||||
myData | myPipe:'arg1':'arg2':'arg3',
|
||||
value
|
||||
| pipeA: {
|
||||
keyA: reallySuperLongValue,
|
||||
keyB: shortValue | pipeB | pipeC: valueToPipeC
|
||||
} : {
|
||||
keyA: reallySuperLongValue,
|
||||
keyB: shortValue | pipeB | pipeC: valueToPipeC
|
||||
}
|
||||
| aaa,
|
||||
(hideLinqPanel ? "ReportSelection.HideShowLabel_Show.String" : "ReportSelection.HideShowLabel_Hide.String") | localize:(localizationSection)
|
||||
]
|
||||
|
||||
=====================================output=====================================
|
||||
[
|
||||
a ? (b | c: d) : (e | f: g),
|
||||
a | b | c | d,
|
||||
a | b | c | d,
|
||||
a | b: (c | d),
|
||||
{ a: b | c },
|
||||
a + b | c,
|
||||
(a | b) + c,
|
||||
fn(a | b),
|
||||
a?.b(c | d),
|
||||
a[b | c],
|
||||
($students | async).items,
|
||||
($students | async)(),
|
||||
myData | myPipe: "arg1":"arg2":"arg3",
|
||||
value
|
||||
| pipeA
|
||||
: {
|
||||
keyA: reallySuperLongValue,
|
||||
keyB: shortValue | pipeB | pipeC: valueToPipeC
|
||||
}
|
||||
: {
|
||||
keyA: reallySuperLongValue,
|
||||
keyB: shortValue | pipeB | pipeC: valueToPipeC
|
||||
}
|
||||
| aaa,
|
||||
(hideLinqPanel
|
||||
? "ReportSelection.HideShowLabel_Show.String"
|
||||
: "ReportSelection.HideShowLabel_Hide.String"
|
||||
) | localize: localizationSection
|
||||
]
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`pipe-expression.ng 2`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["__ng_interpolation"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
@@ -85,3 +194,70 @@ printWidth: 80
|
||||
]
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`pipe-expression.ng 3`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["__ng_interpolation"]
|
||||
printWidth: 80
|
||||
trailingComma: "all"
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
[
|
||||
a ? (b | c : d) : (e | f : g),
|
||||
a | b | c | d,
|
||||
((a | b) | c) | d,
|
||||
a | b:(c | d),
|
||||
{ a: b | c },
|
||||
(a + b) | c,
|
||||
(a | b) + c,
|
||||
fn(a | b),
|
||||
a?.b(c | d),
|
||||
a[b | c],
|
||||
($students | async).items,
|
||||
($students | async)(),
|
||||
myData | myPipe:'arg1':'arg2':'arg3',
|
||||
value
|
||||
| pipeA: {
|
||||
keyA: reallySuperLongValue,
|
||||
keyB: shortValue | pipeB | pipeC: valueToPipeC
|
||||
} : {
|
||||
keyA: reallySuperLongValue,
|
||||
keyB: shortValue | pipeB | pipeC: valueToPipeC
|
||||
}
|
||||
| aaa,
|
||||
(hideLinqPanel ? "ReportSelection.HideShowLabel_Show.String" : "ReportSelection.HideShowLabel_Hide.String") | localize:(localizationSection)
|
||||
]
|
||||
|
||||
=====================================output=====================================
|
||||
[
|
||||
a ? (b | c: d) : (e | f: g),
|
||||
a | b | c | d,
|
||||
a | b | c | d,
|
||||
a | b: (c | d),
|
||||
{ a: b | c },
|
||||
a + b | c,
|
||||
(a | b) + c,
|
||||
fn(a | b),
|
||||
a?.b(c | d),
|
||||
a[b | c],
|
||||
($students | async).items,
|
||||
($students | async)(),
|
||||
myData | myPipe: "arg1":"arg2":"arg3",
|
||||
value
|
||||
| pipeA
|
||||
: {
|
||||
keyA: reallySuperLongValue,
|
||||
keyB: shortValue | pipeB | pipeC: valueToPipeC
|
||||
}
|
||||
: {
|
||||
keyA: reallySuperLongValue,
|
||||
keyB: shortValue | pipeB | pipeC: valueToPipeC
|
||||
}
|
||||
| aaa,
|
||||
(hideLinqPanel
|
||||
? "ReportSelection.HideShowLabel_Show.String"
|
||||
: "ReportSelection.HideShowLabel_Hide.String"
|
||||
) | localize: localizationSection
|
||||
]
|
||||
================================================================================
|
||||
`;
|
||||
@@ -1 +1,3 @@
|
||||
run_spec(__dirname, ["__ng_interpolation"], { trailingComma: "none" });
|
||||
run_spec(__dirname, ["__ng_interpolation"]);
|
||||
run_spec(__dirname, ["__ng_interpolation"], { trailingComma: "all" });
|
||||
@@ -110,17 +110,17 @@ printWidth: 80
|
||||
[
|
||||
[0, 1],
|
||||
[0, 1],
|
||||
[0, 1]
|
||||
[0, 1],
|
||||
];
|
||||
[[], [1, 2, 3]];
|
||||
[[1], [1]];
|
||||
[
|
||||
[1, 2],
|
||||
[1, 2, 3]
|
||||
[1, 2, 3],
|
||||
];
|
||||
[
|
||||
[1, 0],
|
||||
[1, 0]
|
||||
[1, 0],
|
||||
];
|
||||
[{}];
|
||||
[{}, {}];
|
||||
@@ -138,11 +138,11 @@ printWidth: 80
|
||||
[{ a, b }, { a }, { a }];
|
||||
[
|
||||
{ a, b },
|
||||
{ a, b }
|
||||
{ a, b },
|
||||
];
|
||||
[
|
||||
{ a, b },
|
||||
{ a, b, c }
|
||||
{ a, b, c },
|
||||
];
|
||||
|
||||
================================================================================
|
||||
|
||||
@@ -609,7 +609,7 @@ Seq(typeDef.interface.groups).forEach(group =>
|
||||
Seq(group.members).forEach((member, memberName) =>
|
||||
markdownDoc(member.doc, {
|
||||
typePath: typePath.concat(memberName.slice(1)),
|
||||
signatures: member.signatures
|
||||
signatures: member.signatures,
|
||||
})
|
||||
)
|
||||
);
|
||||
@@ -640,7 +640,7 @@ function render() {
|
||||
this.setState({
|
||||
progress: Math.round(
|
||||
(100 * e.nativeEvent.loaded) / e.nativeEvent.total
|
||||
)
|
||||
),
|
||||
})
|
||||
}
|
||||
/>
|
||||
@@ -656,7 +656,7 @@ function render() {
|
||||
this.setState({
|
||||
progress: Math.round(
|
||||
(100 * e.nativeEvent.loaded) / e.nativeEvent.total
|
||||
)
|
||||
),
|
||||
})
|
||||
}
|
||||
/>
|
||||
@@ -672,7 +672,7 @@ function render() {
|
||||
this.setState({
|
||||
progress: Math.round(
|
||||
(100 * e.nativeEvent.loaded) / e.nativeEvent.total
|
||||
)
|
||||
),
|
||||
})
|
||||
}
|
||||
/>
|
||||
@@ -698,7 +698,7 @@ foo(
|
||||
({
|
||||
a,
|
||||
|
||||
b
|
||||
b,
|
||||
}) => {}
|
||||
);
|
||||
|
||||
@@ -711,7 +711,7 @@ foo(
|
||||
({
|
||||
a,
|
||||
|
||||
b
|
||||
b,
|
||||
}) => {}
|
||||
);
|
||||
|
||||
@@ -719,7 +719,7 @@ foo(
|
||||
({
|
||||
a,
|
||||
|
||||
b
|
||||
b,
|
||||
}) => a
|
||||
);
|
||||
|
||||
@@ -732,8 +732,8 @@ foo(
|
||||
a: {
|
||||
a,
|
||||
|
||||
b
|
||||
}
|
||||
b,
|
||||
},
|
||||
}) => {}
|
||||
);
|
||||
|
||||
@@ -743,9 +743,9 @@ foo(
|
||||
b: {
|
||||
c,
|
||||
|
||||
d
|
||||
}
|
||||
}
|
||||
d,
|
||||
},
|
||||
},
|
||||
}) => {}
|
||||
);
|
||||
|
||||
@@ -756,10 +756,10 @@ foo(
|
||||
c: {
|
||||
d,
|
||||
|
||||
e
|
||||
}
|
||||
}
|
||||
}
|
||||
e,
|
||||
},
|
||||
},
|
||||
},
|
||||
}) => {}
|
||||
);
|
||||
|
||||
@@ -768,8 +768,8 @@ foo(
|
||||
a: {
|
||||
a,
|
||||
|
||||
b
|
||||
}
|
||||
b,
|
||||
},
|
||||
}) => a
|
||||
);
|
||||
|
||||
@@ -779,9 +779,9 @@ foo(
|
||||
b: {
|
||||
c,
|
||||
|
||||
d
|
||||
}
|
||||
}
|
||||
d,
|
||||
},
|
||||
},
|
||||
}) => a
|
||||
);
|
||||
|
||||
@@ -792,10 +792,10 @@ foo(
|
||||
c: {
|
||||
d,
|
||||
|
||||
e
|
||||
}
|
||||
}
|
||||
}
|
||||
e,
|
||||
},
|
||||
},
|
||||
},
|
||||
}) => a
|
||||
);
|
||||
|
||||
@@ -807,11 +807,11 @@ foo(
|
||||
c: {
|
||||
d,
|
||||
|
||||
e
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
e,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
]) => {}
|
||||
);
|
||||
|
||||
@@ -823,10 +823,10 @@ foo(
|
||||
c: {
|
||||
d,
|
||||
|
||||
e
|
||||
}
|
||||
}
|
||||
}
|
||||
e,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
]) => {}
|
||||
);
|
||||
@@ -839,10 +839,10 @@ foo(
|
||||
c: {
|
||||
d,
|
||||
|
||||
e
|
||||
}
|
||||
}
|
||||
}
|
||||
e,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
) => {}
|
||||
);
|
||||
@@ -853,9 +853,9 @@ foo(
|
||||
{
|
||||
a,
|
||||
|
||||
b
|
||||
}
|
||||
]
|
||||
b,
|
||||
},
|
||||
],
|
||||
}) => {}
|
||||
);
|
||||
|
||||
@@ -865,8 +865,8 @@ foo(
|
||||
{
|
||||
a,
|
||||
|
||||
b
|
||||
}
|
||||
b,
|
||||
},
|
||||
]
|
||||
) => a
|
||||
);
|
||||
@@ -877,9 +877,9 @@ foo(
|
||||
{
|
||||
a,
|
||||
|
||||
b
|
||||
}
|
||||
]
|
||||
b,
|
||||
},
|
||||
],
|
||||
]) => {}
|
||||
);
|
||||
|
||||
@@ -895,13 +895,13 @@ foo(
|
||||
d: {
|
||||
e,
|
||||
|
||||
f
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
]
|
||||
f,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
],
|
||||
]) => {}
|
||||
);
|
||||
|
||||
@@ -910,7 +910,7 @@ foo(
|
||||
...{
|
||||
a,
|
||||
|
||||
b
|
||||
b,
|
||||
}
|
||||
) => {}
|
||||
);
|
||||
@@ -921,8 +921,8 @@ foo(
|
||||
{
|
||||
a,
|
||||
|
||||
b
|
||||
}
|
||||
b,
|
||||
},
|
||||
]
|
||||
) => {}
|
||||
);
|
||||
@@ -933,8 +933,8 @@ foo(
|
||||
{
|
||||
a,
|
||||
|
||||
b
|
||||
}
|
||||
b,
|
||||
},
|
||||
]
|
||||
]) => {}
|
||||
);
|
||||
@@ -945,8 +945,8 @@ foo(
|
||||
{
|
||||
a,
|
||||
|
||||
b
|
||||
}
|
||||
b,
|
||||
},
|
||||
]
|
||||
) => {}
|
||||
);
|
||||
@@ -956,7 +956,7 @@ foo(
|
||||
a = (({
|
||||
a,
|
||||
|
||||
b
|
||||
b,
|
||||
}) => {})()
|
||||
) => {}
|
||||
);
|
||||
@@ -966,7 +966,7 @@ foo(
|
||||
a = f({
|
||||
a,
|
||||
|
||||
b
|
||||
b,
|
||||
})
|
||||
) => {}
|
||||
);
|
||||
@@ -976,7 +976,7 @@ foo(
|
||||
a = ({
|
||||
a,
|
||||
|
||||
b
|
||||
b,
|
||||
}) => {}
|
||||
) => {}
|
||||
);
|
||||
@@ -987,7 +987,7 @@ foo(
|
||||
f({
|
||||
a,
|
||||
|
||||
b
|
||||
b,
|
||||
})
|
||||
) => {}
|
||||
);
|
||||
@@ -1406,7 +1406,7 @@ Seq(typeDef.interface.groups).forEach((group) =>
|
||||
Seq(group.members).forEach((member, memberName) =>
|
||||
markdownDoc(member.doc, {
|
||||
typePath: typePath.concat(memberName.slice(1)),
|
||||
signatures: member.signatures
|
||||
signatures: member.signatures,
|
||||
})
|
||||
)
|
||||
);
|
||||
@@ -1437,7 +1437,7 @@ function render() {
|
||||
this.setState({
|
||||
progress: Math.round(
|
||||
(100 * e.nativeEvent.loaded) / e.nativeEvent.total
|
||||
)
|
||||
),
|
||||
})
|
||||
}
|
||||
/>
|
||||
@@ -1453,7 +1453,7 @@ function render() {
|
||||
this.setState({
|
||||
progress: Math.round(
|
||||
(100 * e.nativeEvent.loaded) / e.nativeEvent.total
|
||||
)
|
||||
),
|
||||
})
|
||||
}
|
||||
/>
|
||||
@@ -1469,7 +1469,7 @@ function render() {
|
||||
this.setState({
|
||||
progress: Math.round(
|
||||
(100 * e.nativeEvent.loaded) / e.nativeEvent.total
|
||||
)
|
||||
),
|
||||
})
|
||||
}
|
||||
/>
|
||||
@@ -1495,7 +1495,7 @@ foo(
|
||||
({
|
||||
a,
|
||||
|
||||
b
|
||||
b,
|
||||
}) => {}
|
||||
);
|
||||
|
||||
@@ -1508,7 +1508,7 @@ foo(
|
||||
({
|
||||
a,
|
||||
|
||||
b
|
||||
b,
|
||||
}) => {}
|
||||
);
|
||||
|
||||
@@ -1516,7 +1516,7 @@ foo(
|
||||
({
|
||||
a,
|
||||
|
||||
b
|
||||
b,
|
||||
}) => a
|
||||
);
|
||||
|
||||
@@ -1529,8 +1529,8 @@ foo(
|
||||
a: {
|
||||
a,
|
||||
|
||||
b
|
||||
}
|
||||
b,
|
||||
},
|
||||
}) => {}
|
||||
);
|
||||
|
||||
@@ -1540,9 +1540,9 @@ foo(
|
||||
b: {
|
||||
c,
|
||||
|
||||
d
|
||||
}
|
||||
}
|
||||
d,
|
||||
},
|
||||
},
|
||||
}) => {}
|
||||
);
|
||||
|
||||
@@ -1553,10 +1553,10 @@ foo(
|
||||
c: {
|
||||
d,
|
||||
|
||||
e
|
||||
}
|
||||
}
|
||||
}
|
||||
e,
|
||||
},
|
||||
},
|
||||
},
|
||||
}) => {}
|
||||
);
|
||||
|
||||
@@ -1565,8 +1565,8 @@ foo(
|
||||
a: {
|
||||
a,
|
||||
|
||||
b
|
||||
}
|
||||
b,
|
||||
},
|
||||
}) => a
|
||||
);
|
||||
|
||||
@@ -1576,9 +1576,9 @@ foo(
|
||||
b: {
|
||||
c,
|
||||
|
||||
d
|
||||
}
|
||||
}
|
||||
d,
|
||||
},
|
||||
},
|
||||
}) => a
|
||||
);
|
||||
|
||||
@@ -1589,10 +1589,10 @@ foo(
|
||||
c: {
|
||||
d,
|
||||
|
||||
e
|
||||
}
|
||||
}
|
||||
}
|
||||
e,
|
||||
},
|
||||
},
|
||||
},
|
||||
}) => a
|
||||
);
|
||||
|
||||
@@ -1604,11 +1604,11 @@ foo(
|
||||
c: {
|
||||
d,
|
||||
|
||||
e
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
e,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
]) => {}
|
||||
);
|
||||
|
||||
@@ -1620,10 +1620,10 @@ foo(
|
||||
c: {
|
||||
d,
|
||||
|
||||
e
|
||||
}
|
||||
}
|
||||
}
|
||||
e,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
]) => {}
|
||||
);
|
||||
@@ -1636,10 +1636,10 @@ foo(
|
||||
c: {
|
||||
d,
|
||||
|
||||
e
|
||||
}
|
||||
}
|
||||
}
|
||||
e,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
) => {}
|
||||
);
|
||||
@@ -1650,9 +1650,9 @@ foo(
|
||||
{
|
||||
a,
|
||||
|
||||
b
|
||||
}
|
||||
]
|
||||
b,
|
||||
},
|
||||
],
|
||||
}) => {}
|
||||
);
|
||||
|
||||
@@ -1662,8 +1662,8 @@ foo(
|
||||
{
|
||||
a,
|
||||
|
||||
b
|
||||
}
|
||||
b,
|
||||
},
|
||||
]
|
||||
) => a
|
||||
);
|
||||
@@ -1674,9 +1674,9 @@ foo(
|
||||
{
|
||||
a,
|
||||
|
||||
b
|
||||
}
|
||||
]
|
||||
b,
|
||||
},
|
||||
],
|
||||
]) => {}
|
||||
);
|
||||
|
||||
@@ -1692,13 +1692,13 @@ foo(
|
||||
d: {
|
||||
e,
|
||||
|
||||
f
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
]
|
||||
f,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
],
|
||||
]) => {}
|
||||
);
|
||||
|
||||
@@ -1707,7 +1707,7 @@ foo(
|
||||
...{
|
||||
a,
|
||||
|
||||
b
|
||||
b,
|
||||
}
|
||||
) => {}
|
||||
);
|
||||
@@ -1718,8 +1718,8 @@ foo(
|
||||
{
|
||||
a,
|
||||
|
||||
b
|
||||
}
|
||||
b,
|
||||
},
|
||||
]
|
||||
) => {}
|
||||
);
|
||||
@@ -1730,8 +1730,8 @@ foo(
|
||||
{
|
||||
a,
|
||||
|
||||
b
|
||||
}
|
||||
b,
|
||||
},
|
||||
]
|
||||
]) => {}
|
||||
);
|
||||
@@ -1742,8 +1742,8 @@ foo(
|
||||
{
|
||||
a,
|
||||
|
||||
b
|
||||
}
|
||||
b,
|
||||
},
|
||||
]
|
||||
) => {}
|
||||
);
|
||||
@@ -1753,7 +1753,7 @@ foo(
|
||||
a = (({
|
||||
a,
|
||||
|
||||
b
|
||||
b,
|
||||
}) => {})()
|
||||
) => {}
|
||||
);
|
||||
@@ -1763,7 +1763,7 @@ foo(
|
||||
a = f({
|
||||
a,
|
||||
|
||||
b
|
||||
b,
|
||||
})
|
||||
) => {}
|
||||
);
|
||||
@@ -1773,7 +1773,7 @@ foo(
|
||||
a = ({
|
||||
a,
|
||||
|
||||
b
|
||||
b,
|
||||
}) => {}
|
||||
) => {}
|
||||
);
|
||||
@@ -1784,7 +1784,7 @@ foo(
|
||||
f({
|
||||
a,
|
||||
|
||||
b
|
||||
b,
|
||||
})
|
||||
) => {}
|
||||
);
|
||||
@@ -1852,7 +1852,7 @@ export const bem = block =>
|
||||
".",
|
||||
css(block),
|
||||
element ? \`__\${css(element)}\` : "",
|
||||
modifier ? \`--\${css(modifier)}\` : ""
|
||||
modifier ? \`--\${css(modifier)}\` : "",
|
||||
].join("");
|
||||
|
||||
<FlatList
|
||||
@@ -1925,7 +1925,7 @@ export const bem = (block) =>
|
||||
".",
|
||||
css(block),
|
||||
element ? \`__\${css(element)}\` : "",
|
||||
modifier ? \`--\${css(modifier)}\` : ""
|
||||
modifier ? \`--\${css(modifier)}\` : "",
|
||||
].join("");
|
||||
|
||||
<FlatList
|
||||
@@ -2085,7 +2085,7 @@ const foo = () => {
|
||||
message: "test",
|
||||
messageType: "SMS",
|
||||
status: "Unknown",
|
||||
created: "11/01/2017 13:36"
|
||||
created: "11/01/2017 13:36",
|
||||
});
|
||||
};
|
||||
|
||||
@@ -2109,7 +2109,7 @@ const foo = () => {
|
||||
message: "test",
|
||||
messageType: "SMS",
|
||||
status: "Unknown",
|
||||
created: "11/01/2017 13:36"
|
||||
created: "11/01/2017 13:36",
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -51,14 +51,14 @@ let {
|
||||
bottom: offsetBottom,
|
||||
left: offsetLeft,
|
||||
right: offsetRight,
|
||||
top: offsetTop
|
||||
top: offsetTop,
|
||||
} = getPressRectOffset == null ? DEFAULT_PRESS_RECT : getPressRectOffset();
|
||||
|
||||
const {
|
||||
accessibilityModule: FooAccessibilityModule,
|
||||
accessibilityModule: FooAccessibilityModule2,
|
||||
accessibilityModule: FooAccessibilityModule3,
|
||||
accessibilityModule: FooAccessibilityModule4
|
||||
accessibilityModule: FooAccessibilityModule4,
|
||||
} = foo || {};
|
||||
|
||||
({ prop: toAssign = "default" } = { prop: "propval" });
|
||||
|
||||
@@ -38,7 +38,7 @@ function f() {
|
||||
entity.isInstallAvailable() &&
|
||||
!entity.isQueue() &&
|
||||
entity.isDisabled() && {
|
||||
id: entity.id
|
||||
id: entity.id,
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -459,7 +459,7 @@ prevState = prevState || {
|
||||
loadState: LOADED,
|
||||
opened: false,
|
||||
searchQuery: "",
|
||||
selectedCatalog: null
|
||||
selectedCatalog: null,
|
||||
};
|
||||
|
||||
prevState = prevState ||
|
||||
@@ -468,7 +468,7 @@ prevState = prevState ||
|
||||
loadState: LOADED,
|
||||
opened: false,
|
||||
searchQuery: "",
|
||||
selectedCatalog: null
|
||||
selectedCatalog: null,
|
||||
};
|
||||
|
||||
prevState =
|
||||
@@ -478,7 +478,7 @@ prevState =
|
||||
loadState: LOADED,
|
||||
opened: false,
|
||||
searchQuery: "",
|
||||
selectedCatalog: null
|
||||
selectedCatalog: null,
|
||||
});
|
||||
|
||||
prevState = prevState ||
|
||||
@@ -487,14 +487,14 @@ prevState = prevState ||
|
||||
loadState: LOADED,
|
||||
opened: false,
|
||||
searchQuery: "",
|
||||
selectedCatalog: null
|
||||
selectedCatalog: null,
|
||||
};
|
||||
|
||||
this.steps = steps || [
|
||||
{
|
||||
name: "mock-module",
|
||||
path: "/nux/mock-module"
|
||||
}
|
||||
path: "/nux/mock-module",
|
||||
},
|
||||
];
|
||||
|
||||
this.steps =
|
||||
@@ -502,15 +502,15 @@ this.steps =
|
||||
(checkStep && [
|
||||
{
|
||||
name: "mock-module",
|
||||
path: "/nux/mock-module"
|
||||
}
|
||||
path: "/nux/mock-module",
|
||||
},
|
||||
]);
|
||||
|
||||
this.steps = (steps && checkStep) || [
|
||||
{
|
||||
name: "mock-module",
|
||||
path: "/nux/mock-module"
|
||||
}
|
||||
path: "/nux/mock-module",
|
||||
},
|
||||
];
|
||||
|
||||
const create = () => {
|
||||
@@ -520,7 +520,7 @@ const create = () => {
|
||||
result.ok && {
|
||||
status: "ok",
|
||||
createdAt: result.createdAt,
|
||||
updatedAt: result.updatedAt
|
||||
updatedAt: result.updatedAt,
|
||||
}
|
||||
);
|
||||
};
|
||||
@@ -531,7 +531,7 @@ const create = () => {
|
||||
(shouldReturn && result.ok && result) || {
|
||||
status: "ok",
|
||||
createdAt: result.createdAt,
|
||||
updatedAt: result.updatedAt
|
||||
updatedAt: result.updatedAt,
|
||||
}
|
||||
);
|
||||
};
|
||||
@@ -540,12 +540,12 @@ const obj = {
|
||||
state: shouldHaveState &&
|
||||
stateIsOK && {
|
||||
loadState: LOADED,
|
||||
opened: false
|
||||
opened: false,
|
||||
},
|
||||
loadNext: (stateIsOK && hasNext) || {
|
||||
skipNext: true
|
||||
skipNext: true,
|
||||
},
|
||||
loaded: true
|
||||
loaded: true,
|
||||
};
|
||||
|
||||
================================================================================
|
||||
@@ -611,7 +611,7 @@ printWidth: 80
|
||||
!isJellyfishEnabled &&
|
||||
diffUpdateMessageInput && {
|
||||
fontSize: 14,
|
||||
color: "#fff"
|
||||
color: "#fff",
|
||||
}
|
||||
}
|
||||
/>;
|
||||
|
||||
@@ -189,7 +189,7 @@ function helloWorld() {
|
||||
props.value,
|
||||
props.value,
|
||||
props.value,
|
||||
props.value
|
||||
props.value,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ function helloWorldWithReact() {
|
||||
props.value,
|
||||
props.value,
|
||||
props.value,
|
||||
props.value
|
||||
props.value,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ class InMemoryAppender extends log4javascript.Appender
|
||||
implements ICachedLogMessageProvider {}
|
||||
|
||||
class Foo extends Immutable.Record({
|
||||
ipaddress: ""
|
||||
ipaddress: "",
|
||||
}) {
|
||||
ipaddress: string;
|
||||
}
|
||||
@@ -197,7 +197,7 @@ class C {
|
||||
}
|
||||
|
||||
({
|
||||
name /*comment*/() {}
|
||||
name /*comment*/() {},
|
||||
});
|
||||
|
||||
================================================================================
|
||||
@@ -258,7 +258,7 @@ class B {
|
||||
this.props.foofoofoofoofoofoo && this.props.barbarbarbar;
|
||||
|
||||
someInstanceProperty2 = {
|
||||
foo: this.props.foofoofoofoofoofoo && this.props.barbarbarbar
|
||||
foo: this.props.foofoofoofoofoofoo && this.props.barbarbarbar,
|
||||
};
|
||||
|
||||
someInstanceProperty3 = "foo";
|
||||
|
||||
@@ -37,7 +37,7 @@ const { a /* comment */ = 1 } = b;
|
||||
const { c = 1 /* comment */ } = d;
|
||||
|
||||
let {
|
||||
d = b //comment
|
||||
d = b, //comment
|
||||
} = c;
|
||||
|
||||
================================================================================
|
||||
@@ -61,7 +61,7 @@ const foo = {
|
||||
a: "a" /* comment for this line */,
|
||||
|
||||
/* Section B */
|
||||
b: "b"
|
||||
b: "b",
|
||||
};
|
||||
|
||||
================================================================================
|
||||
@@ -527,20 +527,20 @@ export /* comment */{};
|
||||
|
||||
const foo = "";
|
||||
export {
|
||||
foo // comment
|
||||
foo, // comment
|
||||
};
|
||||
|
||||
const bar = "";
|
||||
export {
|
||||
// comment
|
||||
bar
|
||||
bar,
|
||||
};
|
||||
|
||||
const fooo = "";
|
||||
const barr = "";
|
||||
export {
|
||||
fooo, // comment
|
||||
barr // comment
|
||||
barr, // comment
|
||||
};
|
||||
|
||||
================================================================================
|
||||
@@ -702,7 +702,7 @@ const obj = {
|
||||
f1 /* f */() {},
|
||||
f2(/* args */) {},
|
||||
f3() /* returns */ {},
|
||||
f4 /* f */(/* args */) /* returns */ {}
|
||||
f4 /* f */(/* args */) /* returns */ {},
|
||||
};
|
||||
|
||||
(function f /* f */() {})();
|
||||
@@ -1022,7 +1022,7 @@ function f(
|
||||
// not one before and one after.
|
||||
throw new ProcessSystemError({
|
||||
code: acc.error.code, // Alias of errno
|
||||
originalError: acc.error // Just in case.
|
||||
originalError: acc.error, // Just in case.
|
||||
});
|
||||
|
||||
// Adding a comment stops the pretty printing process and everything is
|
||||
@@ -1030,30 +1030,30 @@ throw new ProcessSystemError({
|
||||
export type BuckWebSocketMessage =
|
||||
| {
|
||||
// Not actually from Buck - this is to let the receiver know that the socket is connected.
|
||||
type: "SocketConnected"
|
||||
type: "SocketConnected",
|
||||
}
|
||||
| {
|
||||
type: "BuildProgressUpdated",
|
||||
progressValue: number
|
||||
progressValue: number,
|
||||
}
|
||||
| {
|
||||
type: "BuildFinished",
|
||||
exitCode: number
|
||||
exitCode: number,
|
||||
}
|
||||
| {
|
||||
type: "BuildStarted"
|
||||
type: "BuildStarted",
|
||||
}
|
||||
| {
|
||||
type: "ParseStarted"
|
||||
type: "ParseStarted",
|
||||
}
|
||||
| {
|
||||
type: "ParseFinished"
|
||||
type: "ParseFinished",
|
||||
}
|
||||
| {
|
||||
type: "RunStarted"
|
||||
type: "RunStarted",
|
||||
}
|
||||
| {
|
||||
type: "RunComplete"
|
||||
type: "RunComplete",
|
||||
};
|
||||
|
||||
// Missing one level of indentation because of the comment
|
||||
@@ -1069,7 +1069,7 @@ const rootEpic = (actions, store) =>
|
||||
export type AsyncExecuteOptions = child_process$execFileOpts & {
|
||||
// The contents to write to stdin.
|
||||
stdin?: ?string,
|
||||
dontLogInNuclide?: ?boolean
|
||||
dontLogInNuclide?: ?boolean,
|
||||
};
|
||||
|
||||
// optional trailing comma gets moved all the way to the beginning
|
||||
@@ -1571,7 +1571,7 @@ var x = {
|
||||
sectionMetaData: SectionMetaData
|
||||
/* $FlowFixMe This error was exposed while converting keyMirror
|
||||
* to keyMirrorRecursive */
|
||||
): $Enum<SectionMode> {}
|
||||
): $Enum<SectionMode> {},
|
||||
};
|
||||
|
||||
class X2 {
|
||||
@@ -2231,7 +2231,7 @@ const CONNECTION_STATUS = (exports.CONNECTION_STATUS = {
|
||||
CLOSED: Object.freeze({ kind: "CLOSED" }),
|
||||
CONNECTED: Object.freeze({ kind: "CONNECTED" }),
|
||||
CONNECTING: Object.freeze({ kind: "CONNECTING" }),
|
||||
NOT_CONNECTED: Object.freeze({ kind: "NOT_CONNECTED" })
|
||||
NOT_CONNECTED: Object.freeze({ kind: "NOT_CONNECTED" }),
|
||||
});
|
||||
|
||||
/* A comment */
|
||||
@@ -2374,23 +2374,23 @@ const foo3 = 123
|
||||
let obj1 =
|
||||
// Comment
|
||||
{
|
||||
key: "val"
|
||||
key: "val",
|
||||
};
|
||||
|
||||
let obj2 =
|
||||
// Comment
|
||||
{
|
||||
key: "val"
|
||||
key: "val",
|
||||
};
|
||||
|
||||
let obj3 = {
|
||||
// Comment
|
||||
key: "val"
|
||||
key: "val",
|
||||
};
|
||||
|
||||
let obj4 = {
|
||||
// Comment
|
||||
key: "val"
|
||||
key: "val",
|
||||
};
|
||||
|
||||
let obj5 =
|
||||
@@ -2403,12 +2403,12 @@ let obj6 =
|
||||
|
||||
let obj7 = [
|
||||
// Comment
|
||||
"val"
|
||||
"val",
|
||||
];
|
||||
|
||||
let obj8 = [
|
||||
// Comment
|
||||
"val"
|
||||
"val",
|
||||
];
|
||||
|
||||
let obj9 =
|
||||
|
||||
@@ -86,7 +86,7 @@ let inlineComment = /* some comment */ someReallyLongFunctionCall(
|
||||
);
|
||||
|
||||
let object = {
|
||||
key: /* some comment */ someReallyLongFunctionCall(withLots, ofArguments)
|
||||
key: /* some comment */ someReallyLongFunctionCall(withLots, ofArguments),
|
||||
};
|
||||
|
||||
// preserve parens only for type casts
|
||||
@@ -138,7 +138,7 @@ const style = /** @type {{
|
||||
}} */ ({
|
||||
width,
|
||||
height,
|
||||
...margins
|
||||
...margins,
|
||||
});
|
||||
|
||||
const style2 = /**
|
||||
@@ -146,7 +146,7 @@ const style2 = /**
|
||||
* width: number,
|
||||
* }}
|
||||
*/ ({
|
||||
width
|
||||
width,
|
||||
});
|
||||
|
||||
// Spaces aren't necessary
|
||||
|
||||
@@ -2584,29 +2584,20 @@ a {
|
||||
@include section-type-1(
|
||||
$header: (
|
||||
margin: 0 0 $margin-base,
|
||||
text-align: left
|
||||
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
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
a {
|
||||
@include item-spotlight-properties-transition(
|
||||
"-title",
|
||||
(
|
||||
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15)
|
||||
line-height: $line-height-h3,
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -2616,7 +2607,16 @@ a {
|
||||
"-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: $brand-primary,
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -2627,7 +2627,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,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ exports[`import_comma.scss 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["scss"]
|
||||
printWidth: 80
|
||||
trailingComma: "none"
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
@import "rounded-corners", "text-shadow";
|
||||
@@ -18,7 +19,6 @@ exports[`import_comma.scss 2`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["scss"]
|
||||
printWidth: 80
|
||||
trailingComma: "es5"
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
@import "rounded-corners", "text-shadow";
|
||||
@@ -33,6 +33,7 @@ exports[`scss.scss 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["scss"]
|
||||
printWidth: 80
|
||||
trailingComma: "none"
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
@media #{$g-breakpoint-tiny} {}
|
||||
@@ -2055,7 +2056,6 @@ exports[`scss.scss 2`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["scss"]
|
||||
printWidth: 80
|
||||
trailingComma: "es5"
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
@media #{$g-breakpoint-tiny} {}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
run_spec(__dirname, ["scss"], { trailingComma: "none" });
|
||||
run_spec(__dirname, ["scss"]);
|
||||
run_spec(__dirname, ["scss"], { trailingComma: "es5" });
|
||||
@@ -4,6 +4,7 @@ exports[`at-rules.css 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["css"]
|
||||
printWidth: 80
|
||||
trailingComma: "none"
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
a {
|
||||
@@ -79,7 +80,6 @@ exports[`at-rules.css 2`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["scss"]
|
||||
printWidth: 80
|
||||
trailingComma: "es5"
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
a {
|
||||
@@ -155,6 +155,7 @@ exports[`declaration.css 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["css"]
|
||||
printWidth: 80
|
||||
trailingComma: "none"
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
a {
|
||||
@@ -173,7 +174,6 @@ exports[`declaration.css 2`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["scss"]
|
||||
printWidth: 80
|
||||
trailingComma: "es5"
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
a {
|
||||
@@ -192,6 +192,7 @@ exports[`list.css 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["css"]
|
||||
printWidth: 80
|
||||
trailingComma: "none"
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
$colors: hotpink deepskyblue firebrick,;
|
||||
@@ -297,7 +298,6 @@ exports[`list.css 2`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["scss"]
|
||||
printWidth: 80
|
||||
trailingComma: "es5"
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
$colors: hotpink deepskyblue firebrick,;
|
||||
@@ -403,6 +403,7 @@ exports[`map.css 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["css"]
|
||||
printWidth: 80
|
||||
trailingComma: "none"
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
$map: (
|
||||
@@ -447,7 +448,6 @@ exports[`map.css 2`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["scss"]
|
||||
printWidth: 80
|
||||
trailingComma: "es5"
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
$map: (
|
||||
@@ -492,6 +492,7 @@ exports[`selector_list.css 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["css"]
|
||||
printWidth: 80
|
||||
trailingComma: "none"
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
asdasldaskdhjkashdahsdkjahskdjhakjsdkjahsdhkasdhkajsdhakjsdhkajsdhjkahskjdkjahsjkdjkakjsdm,
|
||||
@@ -523,7 +524,6 @@ exports[`selector_list.css 2`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["scss"]
|
||||
printWidth: 80
|
||||
trailingComma: "es5"
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
asdasldaskdhjkashdahsdkjahskdjhakjsdkjahsdhkasdhkajsdhakjsdhkajsdhjkahskjdkjahsjkdjkakjsdm,
|
||||
@@ -555,6 +555,7 @@ exports[`variable.css 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["css"]
|
||||
printWidth: 80
|
||||
trailingComma: "none"
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
$test: 1,;
|
||||
@@ -572,7 +573,6 @@ exports[`variable.css 2`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["scss"]
|
||||
printWidth: 80
|
||||
trailingComma: "es5"
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
$test: 1,;
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
run_spec(__dirname, ["css"]);
|
||||
run_spec(__dirname, ["scss"], { trailingComma: "es5" });
|
||||
run_spec(__dirname, ["css"], { trailingComma: "none" });
|
||||
run_spec(__dirname, ["scss"]);
|
||||
@@ -68,7 +68,7 @@ export class HeroButtonComponent {
|
||||
selector: "toh-hero-button",
|
||||
template: \`
|
||||
<button>{{ label }}</button>
|
||||
\`
|
||||
\`,
|
||||
})
|
||||
export class HeroButtonComponent {
|
||||
@Output() change = new EventEmitter<any>();
|
||||
|
||||
@@ -91,7 +91,7 @@ var x = 100;
|
||||
@Hello({
|
||||
a: "a", // Comment is in the wrong place
|
||||
// test
|
||||
b: "2"
|
||||
b: "2",
|
||||
})
|
||||
class X {}
|
||||
|
||||
@@ -103,8 +103,8 @@ class X {}
|
||||
|
||||
// App modules.
|
||||
CoreModule,
|
||||
SharedModule
|
||||
]
|
||||
SharedModule,
|
||||
],
|
||||
})
|
||||
export class AppModule {}
|
||||
|
||||
@@ -324,14 +324,14 @@ const dog = {
|
||||
@readonly
|
||||
@nonenumerable
|
||||
@doubledValue
|
||||
eyes: 2
|
||||
eyes: 2,
|
||||
};
|
||||
|
||||
const foo = {
|
||||
@multipleDecorators
|
||||
@inline
|
||||
@theyWontAllFitInOneline
|
||||
aVeryLongPropName: "A very long string as value"
|
||||
aVeryLongPropName: "A very long string as value",
|
||||
};
|
||||
|
||||
================================================================================
|
||||
|
||||
@@ -58,14 +58,14 @@ a = ([s = 1]) => 1;
|
||||
const { children, ...props } = this.props;
|
||||
|
||||
const {
|
||||
user: { firstName, lastName }
|
||||
user: { firstName, lastName },
|
||||
} = this.props;
|
||||
|
||||
const {
|
||||
name: { first, last },
|
||||
organisation: {
|
||||
address: { street: orgStreetAddress, postcode: orgPostcode }
|
||||
}
|
||||
address: { street: orgStreetAddress, postcode: orgPostcode },
|
||||
},
|
||||
} = user;
|
||||
|
||||
function f({ data: { name } }) {}
|
||||
@@ -73,8 +73,8 @@ function f({ data: { name } }) {}
|
||||
const UserComponent = function({
|
||||
name: { first, last },
|
||||
organisation: {
|
||||
address: { street: orgStreetAddress, postcode: orgPostcode }
|
||||
}
|
||||
address: { street: orgStreetAddress, postcode: orgPostcode },
|
||||
},
|
||||
}) {
|
||||
return;
|
||||
};
|
||||
@@ -83,7 +83,7 @@ const {
|
||||
a,
|
||||
b,
|
||||
c,
|
||||
d: { e }
|
||||
d: { e },
|
||||
} = someObject;
|
||||
|
||||
try {
|
||||
@@ -96,8 +96,8 @@ try {
|
||||
// code
|
||||
} catch ({
|
||||
data: {
|
||||
message: { errors }
|
||||
}
|
||||
message: { errors },
|
||||
},
|
||||
}) {
|
||||
// code
|
||||
}
|
||||
@@ -105,7 +105,7 @@ try {
|
||||
const obj = {
|
||||
func(id, { blog: { title } }) {
|
||||
return id + title;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
class A {
|
||||
|
||||
@@ -66,7 +66,7 @@ const envSpecific = {
|
||||
domain: do {
|
||||
if (env === "production") "https://abc.mno.com/";
|
||||
else if (env === "development") "http://localhost:4000";
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
let x = do {
|
||||
|
||||
@@ -69,7 +69,7 @@ const obj = {
|
||||
f(/* ... */) {},
|
||||
f: (/* ... */) => {},
|
||||
f: function(/* ... */) {},
|
||||
f: function f(/* ... */) {}
|
||||
f: function f(/* ... */) {},
|
||||
};
|
||||
|
||||
class Foo {
|
||||
|
||||
@@ -27,7 +27,7 @@ export {
|
||||
itGo,
|
||||
multiLine,
|
||||
andMore,
|
||||
soWeCanGetItTo80Columns
|
||||
soWeCanGetItTo80Columns,
|
||||
};
|
||||
export { fitsIn, oneLine };
|
||||
|
||||
@@ -62,7 +62,7 @@ export {
|
||||
itGo,
|
||||
multiLine,
|
||||
andMore,
|
||||
soWeCanGetItTo80Columns
|
||||
soWeCanGetItTo80Columns,
|
||||
};
|
||||
export {fitsIn, oneLine};
|
||||
|
||||
|
||||
@@ -23,11 +23,11 @@ export c, { foo } from "mod";
|
||||
export * as d, { bar } from "mod";
|
||||
export { fooooooooooooooooooooooooooooooooooooooooooooooooo } from "fooooooooooooooooooooooooooooo";
|
||||
export Bar, {
|
||||
barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
|
||||
barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr,
|
||||
} from "barrrrrrrrrrrrrrrrrrrrrrrrrrrr";
|
||||
export {
|
||||
foooooooooooooooooooooooooooooooooooooooooooooo,
|
||||
fooooooooooooooooooooooooooooooooooooooooooooooo
|
||||
fooooooooooooooooooooooooooooooooooooooooooooooo,
|
||||
} from "fooooooooooooooooooooooooooooo";
|
||||
|
||||
================================================================================
|
||||
|
||||
@@ -22,7 +22,7 @@ export {
|
||||
value2 as value2_renamed,
|
||||
value3,
|
||||
value4 as value4_renamed,
|
||||
value5
|
||||
value5,
|
||||
} from "exports";
|
||||
|
||||
export a, { b } from "./baz";
|
||||
|
||||
@@ -80,7 +80,7 @@ var qux = function(str: string, i: number): number {
|
||||
var obj: { str: string, i: number, j: boolean } = {
|
||||
str: "...",
|
||||
i: "...",
|
||||
k: false
|
||||
k: false,
|
||||
};
|
||||
|
||||
var arr: Array<number> = [1, 2, "..."];
|
||||
@@ -90,7 +90,7 @@ var array: number[] = [1, 2, "..."];
|
||||
|
||||
var matrix: number[][] = [
|
||||
[1, 2],
|
||||
[3, 4]
|
||||
[3, 4],
|
||||
];
|
||||
var matrix_parens: number[][] = matrix;
|
||||
|
||||
@@ -101,7 +101,7 @@ var array_of_nullable: (?number)[] = [null, 3];
|
||||
|
||||
var array_of_tuple: [number, string][] = [
|
||||
[0, "foo"],
|
||||
[1, "bar"]
|
||||
[1, "bar"],
|
||||
];
|
||||
var array_of_tuple_parens: [number, string][] = array_of_tuple;
|
||||
|
||||
@@ -127,7 +127,7 @@ function param_anno2(
|
||||
return {
|
||||
method: request.method,
|
||||
params: request.params,
|
||||
relative_url: request.path
|
||||
relative_url: request.path,
|
||||
};
|
||||
});
|
||||
// ...
|
||||
|
||||
@@ -187,7 +187,7 @@ let tests = [
|
||||
|
||||
(x + z: empty); // error, string ~> empty
|
||||
(z + x: empty); // error, string ~> empty
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
================================================================================
|
||||
@@ -365,7 +365,7 @@ let tests = [
|
||||
function(x: any, y: number, z: string) {
|
||||
x > y;
|
||||
x > z;
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
================================================================================
|
||||
|
||||
@@ -111,7 +111,7 @@ function reduce_test() {
|
||||
var flattened = [
|
||||
[0, 1],
|
||||
[2, 3],
|
||||
[4, 5]
|
||||
[4, 5],
|
||||
].reduce(function(a, b) {
|
||||
return a.concat(b);
|
||||
});
|
||||
|
||||
@@ -81,7 +81,7 @@ var abig2: Array<{ x: number, y: number }> = [
|
||||
{ x: 0, y: 0, a: true },
|
||||
{ x: 0, y: 0, b: "hey" },
|
||||
{ x: 0, y: 0, c: 1 },
|
||||
{ x: 0, y: 0, c: "hey" }
|
||||
{ x: 0, y: 0, c: "hey" },
|
||||
];
|
||||
|
||||
module.exports = "arrays";
|
||||
|
||||
@@ -559,17 +559,17 @@ var n = new (async function() {
|
||||
var o = {
|
||||
async m() {
|
||||
await 1;
|
||||
}
|
||||
},
|
||||
};
|
||||
var ot = {
|
||||
async m<T>(a: T) {
|
||||
await 1;
|
||||
}
|
||||
},
|
||||
};
|
||||
var oz = {
|
||||
async async(async) {
|
||||
await async;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
var x = { await: 5 };
|
||||
|
||||
@@ -117,7 +117,7 @@ let tests = [
|
||||
function(x: Object, y: mixed) {
|
||||
"foo" in x; // ok
|
||||
"foo" in y; // error
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
================================================================================
|
||||
|
||||
@@ -20,7 +20,7 @@ function f(x) {
|
||||
=====================================output=====================================
|
||||
type F = {
|
||||
(x: string): number,
|
||||
p?: string
|
||||
p?: string,
|
||||
};
|
||||
|
||||
function f(x) {
|
||||
@@ -76,7 +76,7 @@ icall(0); // error, number ~> string
|
||||
icall.call(null, 0); // error, number ~> string
|
||||
|
||||
type Callable = {
|
||||
(x: string): void
|
||||
(x: string): void,
|
||||
};
|
||||
|
||||
declare var callable: Callable;
|
||||
|
||||
@@ -132,7 +132,7 @@ module.exports = {
|
||||
B: B,
|
||||
C: C,
|
||||
D: D,
|
||||
E: E
|
||||
E: E,
|
||||
};
|
||||
|
||||
================================================================================
|
||||
|
||||
@@ -149,7 +149,7 @@ type Foo = {
|
||||
a: string, // exists in TestClass
|
||||
b: string, // doesn't exist
|
||||
c?: ?string, // exists in TestClass, optional
|
||||
d?: number // doesn't exist
|
||||
d?: number, // doesn't exist
|
||||
};
|
||||
|
||||
class TestClass {
|
||||
|
||||
@@ -142,7 +142,7 @@ var global_o = {
|
||||
f: function() {},
|
||||
g: function() {
|
||||
global_y = 42;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
global_o.f();
|
||||
@@ -163,7 +163,7 @@ function local_meth() {
|
||||
f: function() {},
|
||||
g: function() {
|
||||
local_y = 42;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
local_o.f();
|
||||
|
||||
@@ -34,19 +34,19 @@ module.exports = { ColorId, ColorNumber };
|
||||
var ColorId = {
|
||||
RED: "R",
|
||||
GREEN: "G",
|
||||
BLUE: "B"
|
||||
BLUE: "B",
|
||||
};
|
||||
|
||||
var ColorNumber = {
|
||||
RED: "ff0000",
|
||||
GREEN: "00ff00",
|
||||
BLUE: "0000ff"
|
||||
BLUE: "0000ff",
|
||||
};
|
||||
|
||||
var ColorIdToNumber = {
|
||||
[ColorId.RED]: ColorNumber.RED,
|
||||
[ColorId.GREEN]: ColorNumber.GREEN,
|
||||
[ColorId.BLUE]: ColorNumber.BLUE
|
||||
[ColorId.BLUE]: ColorNumber.BLUE,
|
||||
};
|
||||
|
||||
(ColorIdToNumber[ColorId.RED]: "ffffff"); // oops
|
||||
@@ -80,7 +80,7 @@ var { ColorId, ColorNumber } = require("./test");
|
||||
var ColorIdToNumber = {
|
||||
[ColorId.RED]: ColorNumber.RED,
|
||||
[ColorId.GREEN]: ColorNumber.GREEN,
|
||||
[ColorId.BLUE]: ColorNumber.BLUE
|
||||
[ColorId.BLUE]: ColorNumber.BLUE,
|
||||
};
|
||||
|
||||
(ColorIdToNumber[ColorId.GREEN]: "ffffff"); // oops
|
||||
@@ -144,7 +144,7 @@ var dummy = require("./test");
|
||||
module.exports = {
|
||||
...dummy,
|
||||
[hello]: "world",
|
||||
...dummy
|
||||
...dummy,
|
||||
};
|
||||
|
||||
================================================================================
|
||||
@@ -183,14 +183,14 @@ var obj = {
|
||||
x: 0,
|
||||
m() {
|
||||
return this.x;
|
||||
}
|
||||
},
|
||||
};
|
||||
var x: string = obj["m"](); // error, number ~> string
|
||||
|
||||
var arr = [
|
||||
function() {
|
||||
return this.length;
|
||||
}
|
||||
},
|
||||
];
|
||||
var y: string = arr[0](); // error: number ~> string
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ module.exports = {
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
numVal: 42
|
||||
numVal: 42,
|
||||
};
|
||||
|
||||
================================================================================
|
||||
|
||||
@@ -78,7 +78,7 @@ module.exports = {
|
||||
/* @flow */
|
||||
|
||||
module.exports = {
|
||||
numVal: 42
|
||||
numVal: 42,
|
||||
};
|
||||
|
||||
================================================================================
|
||||
|
||||
@@ -37,7 +37,7 @@ Foo.y = 0; // has static property y
|
||||
Foo.prototype = {
|
||||
m() {
|
||||
return 0;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
// exporting Foo directly doesn't work
|
||||
|
||||
@@ -90,7 +90,7 @@ let tests = [
|
||||
Boolean(NaN);
|
||||
Boolean(undefined);
|
||||
Boolean("");
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
================================================================================
|
||||
@@ -166,7 +166,7 @@ let tests = [
|
||||
function(x: Map<string, number>) {
|
||||
(x.get("foo"): boolean); // error, string | void
|
||||
x.get(123); // error, wrong key type
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
================================================================================
|
||||
@@ -236,7 +236,7 @@ let tests = [
|
||||
function() {
|
||||
RegExp("foo", "z"); // error
|
||||
new RegExp("foo", "z"); // error
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
================================================================================
|
||||
|
||||
@@ -21,7 +21,7 @@ declare class _C {
|
||||
foo(): number;
|
||||
}
|
||||
declare var _module: {
|
||||
C: Class<_C>
|
||||
C: Class<_C>,
|
||||
};
|
||||
declare class D extends _module.C {
|
||||
foo(): string;
|
||||
|
||||
@@ -126,7 +126,7 @@ module.exports = {
|
||||
numberValue2: 2,
|
||||
numberValue3: 3,
|
||||
numberValue4: 4,
|
||||
numberValue5: 5
|
||||
numberValue5: 5,
|
||||
};
|
||||
|
||||
================================================================================
|
||||
@@ -484,7 +484,7 @@ declare export {
|
||||
|
||||
declare export {
|
||||
numberValue1,
|
||||
numberValue2 as numberValue2_renamed
|
||||
numberValue2 as numberValue2_renamed,
|
||||
} from "ES6_ExportFrom_Source1";
|
||||
|
||||
================================================================================
|
||||
@@ -514,7 +514,7 @@ declare export {
|
||||
|
||||
declare export {
|
||||
numberValue1,
|
||||
numberValue2 as numberValue2_renamed2
|
||||
numberValue2 as numberValue2_renamed2,
|
||||
} from "ES6_ExportFrom_Source2";
|
||||
|
||||
================================================================================
|
||||
@@ -734,7 +734,7 @@ module.exports = {
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
numberValue: 42
|
||||
numberValue: 42,
|
||||
};
|
||||
|
||||
================================================================================
|
||||
@@ -1365,7 +1365,7 @@ import { specifierNumber } from "ES6_Named1"; // Error: Did you mean \`specifier
|
||||
///////////////////////////////////////////////////
|
||||
import {
|
||||
numberValue1 as numberValue8,
|
||||
numberValue2 as numberValue9
|
||||
numberValue2 as numberValue9,
|
||||
} from "./ES6_ExportAllFromMulti";
|
||||
|
||||
var at1: number = numberValue8;
|
||||
|
||||
@@ -69,7 +69,7 @@ declare module "foo" {
|
||||
declare type Id<T> = T;
|
||||
|
||||
declare var exports: {
|
||||
(a: number, b: number): number
|
||||
(a: number, b: number): number,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -201,22 +201,22 @@ obj_rest({ p: { q: 0, r: null } });
|
||||
|
||||
function obj_prop_annot(
|
||||
{
|
||||
p = true // error: boolean ~> string
|
||||
p = true, // error: boolean ~> string
|
||||
}: {
|
||||
p: string
|
||||
p: string,
|
||||
} = {
|
||||
p: 0 // error: number ~> string
|
||||
p: 0, // error: number ~> string
|
||||
}
|
||||
) {
|
||||
(p: void); // error: string ~> void
|
||||
}
|
||||
|
||||
var {
|
||||
p = true // error: boolean ~> string
|
||||
p = true, // error: boolean ~> string
|
||||
}: {
|
||||
p: string
|
||||
p: string,
|
||||
} = {
|
||||
p: 0 // error: number ~> string
|
||||
p: 0, // error: number ~> string
|
||||
};
|
||||
(p: void); // error: string ~> void
|
||||
|
||||
@@ -620,7 +620,7 @@ function bar() {
|
||||
// @flow
|
||||
|
||||
var { x } = {
|
||||
x: { foo: "foo" }
|
||||
x: { foo: "foo" },
|
||||
};
|
||||
|
||||
function bar() {
|
||||
|
||||
@@ -57,7 +57,7 @@ function foo0(
|
||||
}
|
||||
|
||||
function foo2(x: {
|
||||
[key: string]: number
|
||||
[key: string]: number,
|
||||
}): { [key: string]: number, +toString: () => string } {
|
||||
// x's prototype has a toString method
|
||||
return x;
|
||||
@@ -469,7 +469,7 @@ function mix_with_declared_props(o: { [k: number]: X, p: Y }, x: X, y: Y) {
|
||||
|
||||
// Indeed, dict types are still Objects and have Object.prototype stuff
|
||||
function object_prototype(o: {
|
||||
[k: string]: number
|
||||
[k: string]: number,
|
||||
}): { [k: string]: number, +toString: () => string } {
|
||||
(o.toString(): boolean); // error: string ~> boolean
|
||||
return o; // ok
|
||||
@@ -480,7 +480,7 @@ function object_prototype(o: {
|
||||
// write into a declared prop unsoundly.
|
||||
function unsound_string_conversion_alias_declared_prop(o: {
|
||||
[k: number]: any,
|
||||
"0": X
|
||||
"0": X,
|
||||
}) {
|
||||
o[0] = "not-x"; // a["0"] no longer X
|
||||
}
|
||||
@@ -509,19 +509,19 @@ function subtype_dict_values_fresh_exception() {
|
||||
let a: { [k: string]: A } = {
|
||||
a: new A(), // ok, A == A
|
||||
b: new B(), // ok, B <: A
|
||||
c: new C() // ok, C <: A
|
||||
c: new C(), // ok, C <: A
|
||||
};
|
||||
|
||||
let b: { [k: string]: B } = {
|
||||
a: new A(), // error, A not <: B
|
||||
b: new B(), // ok, B == B
|
||||
c: new C() // ok, C <: A
|
||||
c: new C(), // ok, C <: A
|
||||
};
|
||||
|
||||
let c: { [k: string]: C } = {
|
||||
a: new A(), // error, A not <: C
|
||||
b: new B(), // error, A not <: C
|
||||
c: new C() // ok, C == C
|
||||
c: new C(), // ok, C == C
|
||||
};
|
||||
}
|
||||
|
||||
@@ -777,7 +777,7 @@ function foo3(x: { [key: string]: number }): { foo: number } {
|
||||
|
||||
// error: foo can't exist in x
|
||||
function foo4(x: {
|
||||
[key: string]: number
|
||||
[key: string]: number,
|
||||
}): { [key: string]: number, foo: string } {
|
||||
return x;
|
||||
}
|
||||
@@ -890,7 +890,7 @@ type QueryFunction = (params: Params) => string;
|
||||
var o: { foo: QueryFunction } = {
|
||||
foo(params) {
|
||||
return params.count; // error, number ~/~ string
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = o;
|
||||
|
||||
@@ -105,7 +105,7 @@ export type Pos = {
|
||||
firstLine: number,
|
||||
firstColumn: number,
|
||||
lastLine: number,
|
||||
lastColumn: number
|
||||
lastColumn: number,
|
||||
};
|
||||
|
||||
export type TypedBinaryOpNode = {
|
||||
@@ -115,7 +115,7 @@ export type TypedBinaryOpNode = {
|
||||
rhs: TypedNode,
|
||||
pos: Pos,
|
||||
exprType: InferredType,
|
||||
typed: true
|
||||
typed: true,
|
||||
};
|
||||
|
||||
export type TypedUnaryMinusNode = {
|
||||
@@ -123,7 +123,7 @@ export type TypedUnaryMinusNode = {
|
||||
op: TypedNode,
|
||||
pos: Pos,
|
||||
exprType: InferredType,
|
||||
typed: true
|
||||
typed: true,
|
||||
};
|
||||
|
||||
export type TypedNumberNode = {
|
||||
@@ -131,7 +131,7 @@ export type TypedNumberNode = {
|
||||
value: number,
|
||||
pos: Pos,
|
||||
exprType: "number",
|
||||
typed: true
|
||||
typed: true,
|
||||
};
|
||||
|
||||
export type TypedStringLiteralNode = {
|
||||
@@ -139,7 +139,7 @@ export type TypedStringLiteralNode = {
|
||||
value: string,
|
||||
pos: Pos,
|
||||
exprType: "string",
|
||||
typed: true
|
||||
typed: true,
|
||||
};
|
||||
|
||||
export type TypedVariableNode = {
|
||||
@@ -147,7 +147,7 @@ export type TypedVariableNode = {
|
||||
name: string,
|
||||
pos: Pos,
|
||||
exprType: InferredType,
|
||||
typed: true
|
||||
typed: true,
|
||||
};
|
||||
|
||||
export type TypedFunctionInvocationNode = {
|
||||
@@ -156,7 +156,7 @@ export type TypedFunctionInvocationNode = {
|
||||
parameters: TypedNode[],
|
||||
pos: Pos,
|
||||
exprType: "error" | "string",
|
||||
typed: true
|
||||
typed: true,
|
||||
};
|
||||
|
||||
export type TypedNode =
|
||||
@@ -961,18 +961,18 @@ export type Comment = {
|
||||
loc: ?SourceLocation,
|
||||
value: string,
|
||||
leading: boolean,
|
||||
trailing: boolean
|
||||
trailing: boolean,
|
||||
};
|
||||
|
||||
export type SourceLocation = {
|
||||
start: SourcePosition,
|
||||
end: SourcePosition,
|
||||
source: ?string
|
||||
source: ?string,
|
||||
};
|
||||
|
||||
export type SourcePosition = {
|
||||
line: number,
|
||||
column: number
|
||||
column: number,
|
||||
};
|
||||
|
||||
export type File = {
|
||||
@@ -981,7 +981,7 @@ export type File = {
|
||||
end: SourcePosition,
|
||||
comments: ?Array<Comment>,
|
||||
type: "File",
|
||||
program: Program
|
||||
program: Program,
|
||||
};
|
||||
|
||||
export type Program = {
|
||||
@@ -990,7 +990,7 @@ export type Program = {
|
||||
end: SourcePosition,
|
||||
comments: ?Array<Comment>,
|
||||
type: "Program",
|
||||
body: Statement[]
|
||||
body: Statement[],
|
||||
};
|
||||
|
||||
export type BinaryOperator =
|
||||
@@ -1098,7 +1098,7 @@ export type EmptyStatement = {
|
||||
start: SourcePosition,
|
||||
end: SourcePosition,
|
||||
comments: ?Array<Comment>,
|
||||
type: "EmptyStatement"
|
||||
type: "EmptyStatement",
|
||||
};
|
||||
|
||||
export type BlockStatement = {
|
||||
@@ -1107,7 +1107,7 @@ export type BlockStatement = {
|
||||
end: SourcePosition,
|
||||
comments: ?Array<Comment>,
|
||||
type: "BlockStatement",
|
||||
body: Statement[]
|
||||
body: Statement[],
|
||||
};
|
||||
|
||||
export type ExpressionStatement = {
|
||||
@@ -1116,7 +1116,7 @@ export type ExpressionStatement = {
|
||||
end: SourcePosition,
|
||||
comments: ?Array<Comment>,
|
||||
type: "ExpressionStatement",
|
||||
expression: Expression
|
||||
expression: Expression,
|
||||
};
|
||||
|
||||
export type IfStatement = {
|
||||
@@ -1127,7 +1127,7 @@ export type IfStatement = {
|
||||
type: "IfStatement",
|
||||
test: Expression,
|
||||
consequent: Statement,
|
||||
alternate: ?Statement
|
||||
alternate: ?Statement,
|
||||
};
|
||||
|
||||
export type BreakStatement = {
|
||||
@@ -1136,7 +1136,7 @@ export type BreakStatement = {
|
||||
end: SourcePosition,
|
||||
comments: ?Array<Comment>,
|
||||
type: "BreakStatement",
|
||||
label: ?Identifier
|
||||
label: ?Identifier,
|
||||
};
|
||||
|
||||
export type ContinueStatement = {
|
||||
@@ -1145,7 +1145,7 @@ export type ContinueStatement = {
|
||||
end: SourcePosition,
|
||||
comments: ?Array<Comment>,
|
||||
type: "ContinueStatement",
|
||||
label: ?Identifier
|
||||
label: ?Identifier,
|
||||
};
|
||||
|
||||
export type ReturnStatement = {
|
||||
@@ -1154,7 +1154,7 @@ export type ReturnStatement = {
|
||||
end: SourcePosition,
|
||||
comments: ?Array<Comment>,
|
||||
type: "ReturnStatement",
|
||||
argument: ?Expression
|
||||
argument: ?Expression,
|
||||
};
|
||||
|
||||
export type ThrowStatement = {
|
||||
@@ -1163,7 +1163,7 @@ export type ThrowStatement = {
|
||||
end: SourcePosition,
|
||||
comments: ?Array<Comment>,
|
||||
type: "ThrowStatement",
|
||||
argument: ?Expression
|
||||
argument: ?Expression,
|
||||
};
|
||||
|
||||
export type WhileStatement = {
|
||||
@@ -1173,7 +1173,7 @@ export type WhileStatement = {
|
||||
comments: ?Array<Comment>,
|
||||
type: "WhileStatement",
|
||||
test: Expression,
|
||||
body: Statement
|
||||
body: Statement,
|
||||
};
|
||||
|
||||
export type ForStatement = {
|
||||
@@ -1185,7 +1185,7 @@ export type ForStatement = {
|
||||
init: ?(VariableDeclaration | Expression),
|
||||
test: ?Expression,
|
||||
update: ?Expression,
|
||||
body: Statement
|
||||
body: Statement,
|
||||
};
|
||||
|
||||
export type ForInStatement = {
|
||||
@@ -1196,7 +1196,7 @@ export type ForInStatement = {
|
||||
type: "ForInStatement",
|
||||
left: VariableDeclaration | Expression,
|
||||
right: Expression,
|
||||
body: Statement
|
||||
body: Statement,
|
||||
};
|
||||
|
||||
export type TryStatement = {
|
||||
@@ -1208,7 +1208,7 @@ export type TryStatement = {
|
||||
block: BlockStatement,
|
||||
handler: ?CatchClause,
|
||||
handlers: CatchClause[],
|
||||
finalizer: ?BlockStatement
|
||||
finalizer: ?BlockStatement,
|
||||
};
|
||||
|
||||
export type CatchClause = {
|
||||
@@ -1219,7 +1219,7 @@ export type CatchClause = {
|
||||
type: "CatchClause",
|
||||
param: Pattern,
|
||||
guard: ?Expression,
|
||||
body: BlockStatement
|
||||
body: BlockStatement,
|
||||
};
|
||||
|
||||
export type Expression =
|
||||
@@ -1245,7 +1245,7 @@ export type Identifier = {
|
||||
end: SourcePosition,
|
||||
comments: ?Array<Comment>,
|
||||
type: "Identifier",
|
||||
name: string
|
||||
name: string,
|
||||
};
|
||||
|
||||
export type Literal = {
|
||||
@@ -1255,7 +1255,7 @@ export type Literal = {
|
||||
comments: ?Array<Comment>,
|
||||
type: "Literal",
|
||||
value: ?(string | boolean | number | RegExp),
|
||||
regex: ?{ pattern: string, flags: string }
|
||||
regex: ?{ pattern: string, flags: string },
|
||||
};
|
||||
|
||||
export type ThisExpression = {
|
||||
@@ -1263,7 +1263,7 @@ export type ThisExpression = {
|
||||
start: SourcePosition,
|
||||
end: SourcePosition,
|
||||
comments: ?Array<Comment>,
|
||||
type: "ThisExpression"
|
||||
type: "ThisExpression",
|
||||
};
|
||||
|
||||
export type ArrayExpression = {
|
||||
@@ -1272,7 +1272,7 @@ export type ArrayExpression = {
|
||||
end: SourcePosition,
|
||||
comments: ?Array<Comment>,
|
||||
type: "ArrayExpression",
|
||||
elements: Expression[]
|
||||
elements: Expression[],
|
||||
};
|
||||
|
||||
export type ObjectExpreession = {
|
||||
@@ -1281,7 +1281,7 @@ export type ObjectExpreession = {
|
||||
end: SourcePosition,
|
||||
comments: ?Array<Comment>,
|
||||
type: "ObjectExpression",
|
||||
properties: Property[]
|
||||
properties: Property[],
|
||||
};
|
||||
|
||||
export type Property = {
|
||||
@@ -1292,7 +1292,7 @@ export type Property = {
|
||||
type: "Property",
|
||||
kind: "init" | "get" | "set",
|
||||
key: Literal | Identifier,
|
||||
value: Expression
|
||||
value: Expression,
|
||||
};
|
||||
|
||||
export type FunctionExpression = {
|
||||
@@ -1303,7 +1303,7 @@ export type FunctionExpression = {
|
||||
type: "FunctionExpression",
|
||||
id: ?Identifier,
|
||||
params: Pattern[],
|
||||
body: BlockStatement
|
||||
body: BlockStatement,
|
||||
};
|
||||
|
||||
export type BinaryExpression = {
|
||||
@@ -1314,7 +1314,7 @@ export type BinaryExpression = {
|
||||
type: "BinaryExpression",
|
||||
operator: BinaryOperator,
|
||||
left: Expression,
|
||||
right: Expression
|
||||
right: Expression,
|
||||
};
|
||||
|
||||
export type UnaryExpression = {
|
||||
@@ -1325,7 +1325,7 @@ export type UnaryExpression = {
|
||||
type: "UnaryExpression",
|
||||
operator: UnaryOperator,
|
||||
argument: Expression,
|
||||
prefix: boolean
|
||||
prefix: boolean,
|
||||
};
|
||||
|
||||
export type AssignmentExpression = {
|
||||
@@ -1336,7 +1336,7 @@ export type AssignmentExpression = {
|
||||
type: "AssignmentExpression",
|
||||
operator: AssignmentOperator,
|
||||
left: Pattern,
|
||||
right: Expression
|
||||
right: Expression,
|
||||
};
|
||||
|
||||
export type UpdateExpression = {
|
||||
@@ -1347,7 +1347,7 @@ export type UpdateExpression = {
|
||||
type: "UpdateExpression",
|
||||
operator: UpdateOperator,
|
||||
argument: Expression,
|
||||
prefix: boolean
|
||||
prefix: boolean,
|
||||
};
|
||||
|
||||
export type LogicalExpression = {
|
||||
@@ -1358,7 +1358,7 @@ export type LogicalExpression = {
|
||||
type: "LogicalExpression",
|
||||
operator: LogicalOperator,
|
||||
left: Expression,
|
||||
right: Expression
|
||||
right: Expression,
|
||||
};
|
||||
|
||||
export type ConditionalExpression = {
|
||||
@@ -1369,7 +1369,7 @@ export type ConditionalExpression = {
|
||||
type: "ConditionalExpression",
|
||||
test: Expression,
|
||||
consequent: Expression,
|
||||
alternate: Expression
|
||||
alternate: Expression,
|
||||
};
|
||||
|
||||
export type NewExpression = {
|
||||
@@ -1379,7 +1379,7 @@ export type NewExpression = {
|
||||
comments: ?Array<Comment>,
|
||||
type: "NewExpression",
|
||||
callee: Expression,
|
||||
arguments: Expression[]
|
||||
arguments: Expression[],
|
||||
};
|
||||
|
||||
export type CallExpression = {
|
||||
@@ -1389,7 +1389,7 @@ export type CallExpression = {
|
||||
comments: ?Array<Comment>,
|
||||
type: "CallExpression",
|
||||
callee: Expression,
|
||||
arguments: Expression[]
|
||||
arguments: Expression[],
|
||||
};
|
||||
|
||||
export type MemberExpression = {
|
||||
@@ -1400,7 +1400,7 @@ export type MemberExpression = {
|
||||
type: "MemberExpression",
|
||||
object: Expression,
|
||||
property: Identifier | Expression,
|
||||
computed: boolean
|
||||
computed: boolean,
|
||||
};
|
||||
// ast-types exports all expressions as patterns.
|
||||
// That seems not like it was intended.
|
||||
@@ -1415,7 +1415,7 @@ export type VariableDeclaration = {
|
||||
comments: ?Array<Comment>,
|
||||
type: "VariableDeclaration",
|
||||
kind: "var" | "let" | "const",
|
||||
declarations: VariableDeclarator[]
|
||||
declarations: VariableDeclarator[],
|
||||
};
|
||||
|
||||
export type FunctionDeclaration = {
|
||||
@@ -1426,7 +1426,7 @@ export type FunctionDeclaration = {
|
||||
type: "FunctionDeclaration",
|
||||
id: Identifier,
|
||||
body: BlockStatement,
|
||||
params: Pattern[]
|
||||
params: Pattern[],
|
||||
};
|
||||
|
||||
export type VariableDeclarator = {
|
||||
@@ -1436,7 +1436,7 @@ export type VariableDeclarator = {
|
||||
comments: ?Array<Comment>,
|
||||
type: "VariableDeclarator",
|
||||
id: Pattern,
|
||||
init: ?Expression
|
||||
init: ?Expression,
|
||||
};
|
||||
|
||||
const a: any = null;
|
||||
@@ -1541,7 +1541,7 @@ export const builders: {
|
||||
body: BlockStatement,
|
||||
params: Pattern[]
|
||||
): FunctionDeclaration,
|
||||
variableDeclarator(id: Pattern, init?: Expression): VariableDeclarator
|
||||
variableDeclarator(id: Pattern, init?: Expression): VariableDeclarator,
|
||||
} = a;
|
||||
|
||||
================================================================================
|
||||
|
||||
@@ -32,7 +32,7 @@ let tests = [
|
||||
// moveTo
|
||||
function(ctx: CanvasRenderingContext2D) {
|
||||
ctx.moveTo("0", "1"); // error: should be numbers
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
================================================================================
|
||||
@@ -62,7 +62,7 @@ let tests = [
|
||||
function(document: Document) {
|
||||
const event = document.createEvent("CustomEvent");
|
||||
event.initCustomEvent("butts", true, false, { nice: 42 });
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
================================================================================
|
||||
@@ -100,7 +100,7 @@ let tests = [
|
||||
(document.createElement("select"): HTMLSelectElement);
|
||||
(document.querySelector("select"): HTMLSelectElement | null);
|
||||
(document.createElement("hr"): HTMLElement); // GH #3752
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
================================================================================
|
||||
@@ -148,7 +148,7 @@ let tests = [
|
||||
element.scrollIntoView({ behavior: "invalid" });
|
||||
element.scrollIntoView({ block: "invalid" });
|
||||
element.scrollIntoView(1);
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
================================================================================
|
||||
@@ -176,7 +176,7 @@ let tests = [
|
||||
// getContext
|
||||
function(el: HTMLCanvasElement) {
|
||||
(el.getContext("2d"): ?CanvasRenderingContext2D);
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
================================================================================
|
||||
@@ -224,7 +224,7 @@ let tests = [
|
||||
element.scrollIntoView({ behavior: "invalid" });
|
||||
element.scrollIntoView({ block: "invalid" });
|
||||
element.scrollIntoView(1);
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
================================================================================
|
||||
@@ -260,7 +260,7 @@ let tests = [
|
||||
el.setRangeText("foo", 123, 234);
|
||||
el.setRangeText("foo", 123, 234, "select");
|
||||
el.setRangeText("foo", 123, 234, "bogus"); // invalid value
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
================================================================================
|
||||
@@ -374,7 +374,7 @@ let tests = [
|
||||
window.onmessage = (event: MessageEvent) => {
|
||||
(event.target: window);
|
||||
};
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
================================================================================
|
||||
@@ -408,7 +408,7 @@ let tests = [
|
||||
(path.arcTo(0, 0, 0, 0, 10): void); // valid
|
||||
(path.arcTo(0, 0, 0, 0, 10, 20, 5): void); // valid
|
||||
(path.arcTo(0, 0, 0, 0, 10, "20", 5): void); // invalid
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
================================================================================
|
||||
@@ -496,9 +496,9 @@ let tests = [
|
||||
oldAttributeValue,
|
||||
newAttributeValue,
|
||||
attributeNamespace
|
||||
) {}
|
||||
}
|
||||
})
|
||||
) {},
|
||||
},
|
||||
}),
|
||||
});
|
||||
},
|
||||
// or with Object.assign()
|
||||
@@ -513,8 +513,8 @@ let tests = [
|
||||
oldAttributeValue,
|
||||
newAttributeValue,
|
||||
attributeNamespace
|
||||
) {}
|
||||
})
|
||||
) {},
|
||||
}),
|
||||
});
|
||||
},
|
||||
// should complain about invalid callback parameters
|
||||
@@ -526,10 +526,10 @@ let tests = [
|
||||
oldVal: string, // Error: This might be null
|
||||
newVal: string, // Error: This might be null
|
||||
namespace: string
|
||||
) {}
|
||||
}
|
||||
) {},
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
================================================================================
|
||||
@@ -930,10 +930,10 @@ let tests = [
|
||||
); // valid
|
||||
document.createNodeIterator(document.body, -1, node => "accept"); // invalid
|
||||
document.createNodeIterator(document.body, -1, {
|
||||
acceptNode: node => NodeFilter.FILTER_ACCEPT
|
||||
acceptNode: node => NodeFilter.FILTER_ACCEPT,
|
||||
}); // valid
|
||||
document.createNodeIterator(document.body, -1, {
|
||||
acceptNode: node => "accept"
|
||||
acceptNode: node => "accept",
|
||||
}); // invalid
|
||||
document.createNodeIterator(document.body, -1, {}); // invalid
|
||||
},
|
||||
@@ -945,13 +945,13 @@ let tests = [
|
||||
); // valid
|
||||
document.createTreeWalker(document.body, -1, node => "accept"); // invalid
|
||||
document.createTreeWalker(document.body, -1, {
|
||||
acceptNode: node => NodeFilter.FILTER_ACCEPT
|
||||
acceptNode: node => NodeFilter.FILTER_ACCEPT,
|
||||
}); // valid
|
||||
document.createTreeWalker(document.body, -1, {
|
||||
acceptNode: node => "accept"
|
||||
acceptNode: node => "accept",
|
||||
}); // invalid
|
||||
document.createTreeWalker(document.body, -1, {}); // invalid
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
================================================================================
|
||||
|
||||
@@ -40,8 +40,8 @@ function isActive(ad: {
|
||||
state: $Keys<{
|
||||
PAUSED: string,
|
||||
ACTIVE: string,
|
||||
DELETED: string
|
||||
}>
|
||||
DELETED: string,
|
||||
}>,
|
||||
}): boolean {
|
||||
return ad.state === "ACTIVE";
|
||||
}
|
||||
@@ -50,7 +50,7 @@ isActive({ state: "PAUSE" });
|
||||
var MyStates = {
|
||||
PAUSED: "PAUSED",
|
||||
ACTIVE: "ACTIVE",
|
||||
DELETED: "DELETED"
|
||||
DELETED: "DELETED",
|
||||
};
|
||||
function isActive2(ad: { state: $Keys<typeof MyStates> }): boolean {
|
||||
return ad.state === MyStates.ACTIVE;
|
||||
|
||||
@@ -118,7 +118,7 @@ module.exports = Object.freeze({
|
||||
*/
|
||||
|
||||
module.exports = Object.freeze({
|
||||
numberValue1: 1
|
||||
numberValue1: 1,
|
||||
});
|
||||
|
||||
================================================================================
|
||||
@@ -154,7 +154,7 @@ module.exports = {
|
||||
numberValue2: 2,
|
||||
numberValue3: 3,
|
||||
numberValue4: 4,
|
||||
numberValue5: 5
|
||||
numberValue5: 5,
|
||||
};
|
||||
|
||||
================================================================================
|
||||
@@ -578,7 +578,7 @@ export {
|
||||
|
||||
export {
|
||||
numberValue1,
|
||||
numberValue2 as numberValue2_renamed
|
||||
numberValue2 as numberValue2_renamed,
|
||||
} from "ES6_ExportFrom_Source1";
|
||||
|
||||
================================================================================
|
||||
@@ -608,7 +608,7 @@ export {
|
||||
|
||||
export {
|
||||
numberValue1,
|
||||
numberValue2 as numberValue2_renamed2
|
||||
numberValue2 as numberValue2_renamed2,
|
||||
} from "ES6_ExportFrom_Source2";
|
||||
|
||||
================================================================================
|
||||
@@ -858,7 +858,7 @@ module.exports = {
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
numberValue: 42
|
||||
numberValue: 42,
|
||||
};
|
||||
|
||||
================================================================================
|
||||
@@ -1518,7 +1518,7 @@ import { specifierNumber } from "ES6_Named1"; // Error: Did you mean \`specifier
|
||||
///////////////////////////////////////////////////
|
||||
import {
|
||||
numberValue1 as numberValue8,
|
||||
numberValue2 as numberValue9
|
||||
numberValue2 as numberValue9,
|
||||
} from "./ES6_ExportAllFromMulti";
|
||||
|
||||
var at1: number = numberValue8;
|
||||
|
||||
@@ -38,7 +38,7 @@ declare module "CJS_Clobbered" {
|
||||
declare var num2: number;
|
||||
declare type numType = number;
|
||||
declare var exports: {
|
||||
numExport: number
|
||||
numExport: number,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ import type {
|
||||
inlinedType1,
|
||||
standaloneType1,
|
||||
talias1,
|
||||
talias3
|
||||
talias3,
|
||||
} from "./types_only";
|
||||
|
||||
var a: inlinedType1 = 42;
|
||||
|
||||
@@ -78,7 +78,7 @@ let tests = [
|
||||
(copyProperties(result, { foo: "a" }, { bar: 123 }): {
|
||||
foo: string,
|
||||
bar: number,
|
||||
baz: boolean
|
||||
baz: boolean,
|
||||
});
|
||||
},
|
||||
|
||||
@@ -100,7 +100,7 @@ let tests = [
|
||||
function(copyProperties: Object$Assign) {
|
||||
function x(cb: Function) {}
|
||||
x(copyProperties);
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
================================================================================
|
||||
@@ -140,7 +140,7 @@ let tests = [
|
||||
let x: ?string = null;
|
||||
invariant(x);
|
||||
(x: string);
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
================================================================================
|
||||
@@ -254,7 +254,7 @@ let tests = [
|
||||
function(mergeInto: $Facebookism$MergeInto) {
|
||||
function x(cb: Function) {}
|
||||
x(mergeInto);
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
================================================================================
|
||||
|
||||
Loaded 100 of 263 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user