Skip to content

Commit

Permalink
fix: Allow template literals for Jest inline snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
jhnns committed Dec 25, 2019
1 parent f28606d commit 2b9c4e5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
6 changes: 4 additions & 2 deletions base.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ module.exports = {
},
],
"babel/object-curly-spacing": ["error", "never"],
"babel/quotes": ["error", "double", "avoid-escape"],
"babel/quotes": ["error", "double", options.quotes],
"babel/semi": "error",
"babel/valid-typeof": "error",
"block-scoped-var": "error", // http://eslint.org/docs/rules/block-scoped-var
Expand Down Expand Up @@ -548,6 +548,8 @@ module.exports = {
"prefer-promise-reject-errors": "error", // http://eslint.org/docs/rules/prefer-promise-reject-errors
"prefer-rest-params": "error", // http://eslint.org/docs/rules/prefer-rest-params
"prefer-spread": "error", // http://eslint.org/docs/rules/prefer-spread
// Using regular string concatentation can sometimes be easier to read
// We leave it up to the developer to decide
"prefer-template": "off", // http://eslint.org/docs/rules/prefer-template
"promise/always-return": "error", // https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/always-return.md
"promise/avoid-new": "off", // https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/avoid-new.md
Expand All @@ -568,7 +570,7 @@ module.exports = {
"promise/valid-params": "error", // https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/valid-params.md
"quote-props": ["error", "as-needed"], // http://eslint.org/docs/rules/quote-props
// Handled by babel/quotes
"quotes": ["off", "double", "avoid-escape"], // http://eslint.org/docs/rules/quotes
"quotes": ["off", "double", options.quotes], // http://eslint.org/docs/rules/quotes
"radix": "off", // http://eslint.org/docs/rules/radix
"require-await": "off", // http://eslint.org/docs/rules/require-await
"require-jsdoc": "off", // http://eslint.org/docs/rules/require-jsdoc
Expand Down
3 changes: 3 additions & 0 deletions options.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ const options = {
caughtErrors: "none",
ignoreRestSiblings: true,
vars: "all",
},
["quotes"]: {
avoidEscape: true,
}
/* eslint-disable sort-keys */
};
Expand Down
4 changes: 4 additions & 0 deletions tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,9 @@ module.exports = {
// If you want to test for thrown errors in a constructor function, it's common to ignore the result
// @see https://github.com/peerigon/clockodo/pull/1#discussion_r180795825
"no-new": "off",
"quotes": ["error", "double", Object.assign({}, options["quotes"], {
// Allow Jest inline snapshots
allowTemplateLiterals: true,
})],
}
};

0 comments on commit 2b9c4e5

Please sign in to comment.