Add espree parser (#9000)
Co-authored-by: Chris Brody <chris.brody+brodybits@gmail.com>
This commit is contained in:
1 parent
2bc68f11f3
commit
73e3976c34
73 files changed
+397
-116
No files matched your search
@@ -45,11 +45,6 @@ func(
|
||||
veryLoooooooooooooooongName.something()
|
||||
);
|
||||
|
||||
const composition = (ViewComponent, ContainerComponent) =>
|
||||
class extends React.Component {
|
||||
static propTypes = {};
|
||||
};
|
||||
|
||||
promise.then(result => result.veryLongVariable.veryLongPropertyName > someOtherVariable ? "ok" : "fail");
|
||||
|
||||
=====================================output=====================================
|
||||
@@ -97,11 +92,6 @@ func(
|
||||
veryLoooooooooooooooongName.something()
|
||||
);
|
||||
|
||||
const composition = (ViewComponent, ContainerComponent) =>
|
||||
class extends React.Component {
|
||||
static propTypes = {};
|
||||
};
|
||||
|
||||
promise.then((result) =>
|
||||
result.veryLongVariable.veryLongPropertyName > someOtherVariable
|
||||
? "ok"
|
||||
@@ -156,11 +146,6 @@ func(
|
||||
veryLoooooooooooooooongName.something()
|
||||
);
|
||||
|
||||
const composition = (ViewComponent, ContainerComponent) =>
|
||||
class extends React.Component {
|
||||
static propTypes = {};
|
||||
};
|
||||
|
||||
promise.then(result => result.veryLongVariable.veryLongPropertyName > someOtherVariable ? "ok" : "fail");
|
||||
|
||||
=====================================output=====================================
|
||||
@@ -208,11 +193,6 @@ func(
|
||||
veryLoooooooooooooooongName.something(),
|
||||
);
|
||||
|
||||
const composition = (ViewComponent, ContainerComponent) =>
|
||||
class extends React.Component {
|
||||
static propTypes = {};
|
||||
};
|
||||
|
||||
promise.then((result) =>
|
||||
result.veryLongVariable.veryLongPropertyName > someOtherVariable
|
||||
? "ok"
|
||||
@@ -266,11 +246,6 @@ func(
|
||||
veryLoooooooooooooooongName.something()
|
||||
);
|
||||
|
||||
const composition = (ViewComponent, ContainerComponent) =>
|
||||
class extends React.Component {
|
||||
static propTypes = {};
|
||||
};
|
||||
|
||||
promise.then(result => result.veryLongVariable.veryLongPropertyName > someOtherVariable ? "ok" : "fail");
|
||||
|
||||
=====================================output=====================================
|
||||
@@ -318,11 +293,6 @@ func(
|
||||
veryLoooooooooooooooongName.something()
|
||||
);
|
||||
|
||||
const composition = (ViewComponent, ContainerComponent) =>
|
||||
class extends React.Component {
|
||||
static propTypes = {};
|
||||
};
|
||||
|
||||
promise.then((result) =>
|
||||
result.veryLongVariable.veryLongPropertyName > someOtherVariable
|
||||
? "ok"
|
||||
@@ -331,3 +301,65 @@ promise.then((result) =>
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`class-property.js - {"arrowParens":"always"} format 1`] = `
|
||||
====================================options=====================================
|
||||
arrowParens: "always"
|
||||
parsers: ["babel", "flow", "typescript"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
const composition = (ViewComponent, ContainerComponent) =>
|
||||
class extends React.Component {
|
||||
static propTypes = {};
|
||||
};
|
||||
|
||||
=====================================output=====================================
|
||||
const composition = (ViewComponent, ContainerComponent) =>
|
||||
class extends React.Component {
|
||||
static propTypes = {};
|
||||
};
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`class-property.js - {"trailingComma":"all"} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "flow", "typescript"]
|
||||
printWidth: 80
|
||||
trailingComma: "all"
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
const composition = (ViewComponent, ContainerComponent) =>
|
||||
class extends React.Component {
|
||||
static propTypes = {};
|
||||
};
|
||||
|
||||
=====================================output=====================================
|
||||
const composition = (ViewComponent, ContainerComponent) =>
|
||||
class extends React.Component {
|
||||
static propTypes = {};
|
||||
};
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`class-property.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "flow", "typescript"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
const composition = (ViewComponent, ContainerComponent) =>
|
||||
class extends React.Component {
|
||||
static propTypes = {};
|
||||
};
|
||||
|
||||
=====================================output=====================================
|
||||
const composition = (ViewComponent, ContainerComponent) =>
|
||||
class extends React.Component {
|
||||
static propTypes = {};
|
||||
};
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
@@ -36,9 +36,4 @@ func(
|
||||
veryLoooooooooooooooongName.something()
|
||||
);
|
||||
|
||||
const composition = (ViewComponent, ContainerComponent) =>
|
||||
class extends React.Component {
|
||||
static propTypes = {};
|
||||
};
|
||||
|
||||
promise.then(result => result.veryLongVariable.veryLongPropertyName > someOtherVariable ? "ok" : "fail");
|
||||
@@ -0,0 +1,4 @@
|
||||
const composition = (ViewComponent, ContainerComponent) =>
|
||||
class extends React.Component {
|
||||
static propTypes = {};
|
||||
};
|
||||
@@ -1,7 +1,15 @@
|
||||
run_spec(__dirname, ["babel", "flow", "typescript"]);
|
||||
const errors = {
|
||||
espree: ["class-property.js"],
|
||||
};
|
||||
|
||||
run_spec(__dirname, ["babel", "flow", "typescript"], {
|
||||
errors,
|
||||
});
|
||||
run_spec(__dirname, ["babel", "flow", "typescript"], {
|
||||
trailingComma: "all",
|
||||
errors,
|
||||
});
|
||||
run_spec(__dirname, ["babel", "flow", "typescript"], {
|
||||
arrowParens: "always",
|
||||
errors,
|
||||
});
|
||||
@@ -1 +1 @@
|
||||
run_spec(__dirname, ["babel"]);
|
||||
run_spec(__dirname, ["babel"], { errors: { espree: true } });
|
||||
@@ -1 +1,3 @@
|
||||
run_spec(__dirname, ["babel"]);
|
||||
run_spec(__dirname, ["babel"], {
|
||||
errors: { espree: ["newline-before-arrow.js"] },
|
||||
});
|
||||
@@ -1,4 +1,31 @@
|
||||
// Only testing babel parsing
|
||||
// Do not add extra parsers here
|
||||
|
||||
run_spec(__dirname, ["babel", "babel-ts", "babel-flow"]);
|
||||
run_spec(__dirname, ["babel", "babel-ts", "babel-flow"], {
|
||||
errors: {
|
||||
espree: [
|
||||
"class-properties.js",
|
||||
"decimal.js",
|
||||
"decorators.js",
|
||||
"do-expressions.js",
|
||||
"export-default-from.js",
|
||||
"flow.js",
|
||||
"function-bind.js",
|
||||
"function-sent.js",
|
||||
"module-attributes-dynamic.js",
|
||||
"module-attributes-static.js",
|
||||
"partial-application.js",
|
||||
"pipeline-operator-fsharp.js",
|
||||
"pipeline-operator-minimal.js",
|
||||
"pipeline-operator-smart.js",
|
||||
"private-fields-in-in.js",
|
||||
"private-methods.js",
|
||||
"record-tuple-record.js",
|
||||
"record-tuple-tuple.js",
|
||||
"throw-expressions.js",
|
||||
"typescript.js",
|
||||
"v8intrinsic.js",
|
||||
"optional-chaining.js",
|
||||
],
|
||||
},
|
||||
});
|
||||
@@ -1,2 +1,2 @@
|
||||
run_spec(__dirname, ["babel"]);
|
||||
run_spec(__dirname, ["babel"], { semi: false });
|
||||
run_spec(__dirname, ["babel"], { errors: { espree: true } });
|
||||
run_spec(__dirname, ["babel"], { semi: false, errors: { espree: true } });
|
||||
@@ -1 +1,5 @@
|
||||
run_spec(__dirname, ["babel", "flow", "typescript"]);
|
||||
run_spec(__dirname, ["babel", "flow", "typescript"], {
|
||||
errors: {
|
||||
espree: ["class-property.js"],
|
||||
},
|
||||
});
|
||||
@@ -1,2 +1,2 @@
|
||||
run_spec(__dirname, ["babel"]);
|
||||
run_spec(__dirname, ["babel"], { semi: false });
|
||||
run_spec(__dirname, ["babel"], { errors: { espree: true } });
|
||||
run_spec(__dirname, ["babel"], { semi: false, errors: { espree: true } });
|
||||
@@ -1 +1,3 @@
|
||||
run_spec(__dirname, ["babel", "flow", "typescript"]);
|
||||
run_spec(__dirname, ["babel", "flow", "typescript"], {
|
||||
errors: { espree: ["property.js"] },
|
||||
});
|
||||
@@ -1 +1 @@
|
||||
run_spec(__dirname, ["babel", "typescript"]);
|
||||
run_spec(__dirname, ["babel", "typescript"], { errors: { espree: true } });
|
||||
@@ -1 +1 @@
|
||||
run_spec(__dirname, ["babel"]);
|
||||
run_spec(__dirname, ["babel"], { errors: { espree: true } });
|
||||
@@ -1 +1 @@
|
||||
run_spec(__dirname, ["babel", "typescript"]);
|
||||
run_spec(__dirname, ["babel", "typescript"], { errors: { espree: true } });
|
||||
@@ -1,2 +1,2 @@
|
||||
// TypeScript and Flow don't accept decorator after export
|
||||
run_spec(__dirname, ["babel"]);
|
||||
run_spec(__dirname, ["babel"], { errors: { espree: true } });
|
||||
@@ -1 +1 @@
|
||||
run_spec(__dirname, ["babel"]);
|
||||
run_spec(__dirname, ["babel"], { errors: { espree: true } });
|
||||
@@ -1 +1 @@
|
||||
run_spec(__dirname, ["babel"]);
|
||||
run_spec(__dirname, ["babel"], { errors: { espree: true } });
|
||||
@@ -1 +1,3 @@
|
||||
run_spec(__dirname, ["babel", "flow", "typescript"]);
|
||||
run_spec(__dirname, ["babel", "flow", "typescript"], {
|
||||
errors: { espree: ["class-property.js"] },
|
||||
});
|
||||
@@ -1 +1,3 @@
|
||||
run_spec(__dirname, ["babel"]);
|
||||
run_spec(__dirname, ["babel"], {
|
||||
errors: { espree: true },
|
||||
});
|
||||
@@ -1 +1 @@
|
||||
run_spec(__dirname, ["babel"]);
|
||||
run_spec(__dirname, ["babel"], { errors: { espree: true } });
|
||||
@@ -1 +1 @@
|
||||
run_spec(__dirname, ["babel"]);
|
||||
run_spec(__dirname, ["babel"], { errors: { espree: true } });
|
||||
@@ -1 +1,5 @@
|
||||
run_spec(__dirname, ["babel", "flow", "typescript"]);
|
||||
run_spec(__dirname, ["babel", "flow", "typescript"], {
|
||||
errors: {
|
||||
espree: [],
|
||||
},
|
||||
});
|
||||
@@ -1 +1 @@
|
||||
run_spec(__dirname, ["babel"]);
|
||||
run_spec(__dirname, ["babel"], { errors: { espree: true } });
|
||||
@@ -1,2 +1,2 @@
|
||||
// flow-parser@0.38.0 fails to parse `1.e1`, so use babel here.
|
||||
run_spec(__dirname, ["babel", "typescript"]);
|
||||
run_spec(__dirname, ["babel", "typescript"], { errors: { espree: true } });
|
||||
@@ -1,5 +1,19 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`invalid.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "typescript"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
c.foo.bar().baz ??= result.foo.bar().baz(a.baz) &&= result.baz;
|
||||
|
||||
=====================================output=====================================
|
||||
c.foo.bar().baz ??= result.foo.bar().baz(a.baz) &&= result.baz;
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`logical-assignment.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "typescript"]
|
||||
@@ -26,7 +40,6 @@ c.foo["baz"] ??= result.foo.baz;
|
||||
|
||||
a.foo.bar().baz &&= result.foo.bar().baz;
|
||||
b.foo.bar().baz ||= result.foo.bar().baz;
|
||||
c.foo.bar().baz ??= result.foo.bar().baz(a.baz) &&= result.baz;
|
||||
b.baz ||= result.baz;
|
||||
c.baz ??= result.baz;
|
||||
|
||||
@@ -83,7 +96,6 @@ c.foo["baz"] ??= result.foo.baz;
|
||||
|
||||
a.foo.bar().baz &&= result.foo.bar().baz;
|
||||
b.foo.bar().baz ||= result.foo.bar().baz;
|
||||
c.foo.bar().baz ??= result.foo.bar().baz(a.baz) &&= result.baz;
|
||||
b.baz ||= result.baz;
|
||||
c.baz ??= result.baz;
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
c.foo.bar().baz ??= result.foo.bar().baz(a.baz) &&= result.baz;
|
||||
@@ -1 +1,3 @@
|
||||
run_spec(__dirname, ["babel", "typescript"]);
|
||||
run_spec(__dirname, ["babel", "typescript"], {
|
||||
errors: { espree: ["invalid.js"] },
|
||||
});
|
||||
@@ -18,7 +18,6 @@ c.foo["baz"] ??= result.foo.baz;
|
||||
|
||||
a.foo.bar().baz &&= result.foo.bar().baz;
|
||||
b.foo.bar().baz ||= result.foo.bar().baz;
|
||||
c.foo.bar().baz ??= result.foo.bar().baz(a.baz) &&= result.baz;
|
||||
b.baz ||= result.baz;
|
||||
c.baz ??= result.baz;
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
run_spec(__dirname, ["babel"]);
|
||||
run_spec(__dirname, ["babel"], { errors: { espree: true } });
|
||||
@@ -250,7 +250,7 @@ const Steps = styled.div\`
|
||||
}
|
||||
\`;
|
||||
|
||||
const Steps = styled.div\`
|
||||
const Steps2 = styled.div\`
|
||||
@media (min-width: \${breakpoints.lg}) {
|
||||
\${Step} {
|
||||
margin-bottom: 90px;
|
||||
@@ -288,7 +288,7 @@ const Steps = styled.div\`
|
||||
}
|
||||
\`;
|
||||
|
||||
const Steps = styled.div\`
|
||||
const Steps2 = styled.div\`
|
||||
@media (min-width: \${breakpoints.lg}) {
|
||||
\${Step} {
|
||||
margin-bottom: 90px;
|
||||
|
||||
@@ -4,7 +4,7 @@ const Steps = styled.div`
|
||||
}
|
||||
`;
|
||||
|
||||
const Steps = styled.div`
|
||||
const Steps2 = styled.div`
|
||||
@media (min-width: ${breakpoints.lg}) {
|
||||
${Step} {
|
||||
margin-bottom: 90px;
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
run_spec(__dirname, ["babel"]);
|
||||
run_spec(__dirname, ["babel"], { semi: false });
|
||||
run_spec(__dirname, ["babel"], { errors: { espree: true } });
|
||||
run_spec(__dirname, ["babel"], { semi: false, errors: { espree: true } });
|
||||
@@ -1,2 +1,4 @@
|
||||
run_spec(__dirname, ["babel", "flow"]);
|
||||
run_spec(__dirname, ["babel", "flow"], { semi: false });
|
||||
const errors = { espree: ["class.js"] };
|
||||
|
||||
run_spec(__dirname, ["babel", "flow"], { errors });
|
||||
run_spec(__dirname, ["babel", "flow"], { semi: false, errors });
|
||||
@@ -1 +1,3 @@
|
||||
run_spec(__dirname, ["babel", "flow"]);
|
||||
run_spec(__dirname, ["babel", "flow"], {
|
||||
errors: { espree: ["comment.js"] },
|
||||
});
|
||||
@@ -1 +1,3 @@
|
||||
run_spec(__dirname, ["babel"]);
|
||||
run_spec(__dirname, ["babel"], {
|
||||
errors: { espree: ["expression.js", "invalid-accessor-generator.js"] },
|
||||
});
|
||||
@@ -1 +1 @@
|
||||
run_spec(__dirname, ["babel"]);
|
||||
run_spec(__dirname, ["babel"], { errors: { espree: true } });
|
||||
@@ -1 +1 @@
|
||||
run_spec(__dirname, ["babel"]);
|
||||
run_spec(__dirname, ["babel"], { errors: { espree: true } });
|
||||
@@ -1 +1 @@
|
||||
run_spec(__dirname, ["babel"]);
|
||||
run_spec(__dirname, ["babel"], { errors: { espree: true } });
|
||||
@@ -1,16 +1,22 @@
|
||||
const errors = { espree: ["classes.js"] };
|
||||
|
||||
run_spec(__dirname, ["babel"], {
|
||||
quoteProps: "as-needed",
|
||||
errors,
|
||||
});
|
||||
|
||||
run_spec(__dirname, ["babel"], {
|
||||
quoteProps: "preserve",
|
||||
errors,
|
||||
});
|
||||
|
||||
run_spec(__dirname, ["babel"], {
|
||||
quoteProps: "consistent",
|
||||
errors,
|
||||
});
|
||||
|
||||
run_spec(__dirname, ["babel"], {
|
||||
quoteProps: "consistent",
|
||||
singleQuote: true,
|
||||
errors,
|
||||
});
|
||||
@@ -1 +1 @@
|
||||
run_spec(__dirname, ["babel"]);
|
||||
run_spec(__dirname, ["babel"], { errors: { espree: true } });
|
||||
@@ -1 +1,4 @@
|
||||
run_spec(__dirname, ["babel", "flow"], { trailingComma: "all" });
|
||||
run_spec(__dirname, ["babel", "flow"], {
|
||||
trailingComma: "all",
|
||||
errors: { espree: true },
|
||||
});
|
||||
@@ -1,2 +1,4 @@
|
||||
run_spec(__dirname, ["babel", "flow", "typescript"]);
|
||||
run_spec(__dirname, ["babel", "flow", "typescript"], { arrowParens: "avoid" });
|
||||
run_spec(__dirname, ["babel", "flow", "typescript"], {
|
||||
arrowParens: "avoid",
|
||||
});
|
||||
@@ -1 +1 @@
|
||||
run_spec(__dirname, ["babel"]);
|
||||
run_spec(__dirname, ["babel"], { errors: { espree: true } });
|
||||
@@ -1 +1 @@
|
||||
run_spec(__dirname, ["babel", "typescript"]);
|
||||
run_spec(__dirname, ["babel", "typescript"], { errors: { espree: true } });
|
||||
@@ -1 +1,3 @@
|
||||
run_spec(__dirname, ["babel", "flow", "typescript"]);
|
||||
run_spec(__dirname, ["babel", "flow", "typescript"], {
|
||||
errors: { espree: true },
|
||||
});
|
||||
@@ -1 +1 @@
|
||||
run_spec(__dirname, ["babel"]);
|
||||
run_spec(__dirname, ["babel"], { errors: { espree: true } });
|
||||
@@ -1 +1 @@
|
||||
run_spec(__dirname, ["babel"]);
|
||||
run_spec(__dirname, ["babel"], { errors: { espree: true } });
|
||||
Reference in new issue
Block a user