Skip to content

Commit

Permalink
feat(eslint-plugin): [restrict-template-expressions] `allowNumber: tr…
Browse files Browse the repository at this point in the history
…ue` by default (#2005)
  • Loading branch information
bradzacher committed May 21, 2020
1 parent 3626a67 commit 643ec24
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Expand Up @@ -38,7 +38,7 @@ type Options = {
};

const defaults = {
allowNumber: false,
allowNumber: true,
allowBoolean: false,
allowAny: false,
allowNullable: false,
Expand Down
Expand Up @@ -41,7 +41,11 @@ export default util.createRule<Options, MessageId>({
},
],
},
defaultOptions: [{}],
defaultOptions: [
{
allowNumber: true,
},
],
create(context, [options]) {
const service = util.getParserServices(context);
const typeChecker = service.program.getTypeChecker();
Expand Down
Expand Up @@ -206,6 +206,7 @@ ruleTester.run('restrict-template-expressions', rule, {
code: `
const msg = \`arg = \${123}\`;
`,
options: [{ allowNumber: false }],
errors: [
{
messageId: 'invalidType',
Expand Down Expand Up @@ -246,6 +247,7 @@ ruleTester.run('restrict-template-expressions', rule, {
declare const arg: number;
const msg = \`arg = \${arg}\`;
`,
options: [{ allowNumber: false }],
errors: [
{
messageId: 'invalidType',
Expand Down

0 comments on commit 643ec24

Please sign in to comment.