Skip to content

Commit 48afde8

Browse files
tfrommengziolo
authored andcommitted
Copy no-restricted-syntax rules from ESLint plugin to config file (#15877)
Also, remove unused import of lodash.map
1 parent a606c4b commit 48afde8

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

.eslintrc.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* External dependencies
33
*/
4-
const { escapeRegExp, map } = require( 'lodash' );
4+
const { escapeRegExp } = require( 'lodash' );
55

66
/**
77
* Internal dependencies
@@ -37,6 +37,18 @@ module.exports = {
3737
selector: 'CallExpression[callee.name="deprecated"] Property[key.name="version"][value.value=/' + majorMinorRegExp + '/]',
3838
message: 'Deprecated functions must be removed before releasing this version.',
3939
},
40+
{
41+
selector: 'CallExpression[callee.name=/^(__|_n|_nx|_x)$/]:not([arguments.0.type=/^Literal|BinaryExpression$/])',
42+
message: 'Translate function arguments must be string literals.',
43+
},
44+
{
45+
selector: 'CallExpression[callee.name=/^(_n|_nx|_x)$/]:not([arguments.1.type=/^Literal|BinaryExpression$/])',
46+
message: 'Translate function arguments must be string literals.',
47+
},
48+
{
49+
selector: 'CallExpression[callee.name=_nx]:not([arguments.3.type=/^Literal|BinaryExpression$/])',
50+
message: 'Translate function arguments must be string literals.',
51+
},
4052
{
4153
selector: 'CallExpression[callee.name=/^(__|_x|_n|_nx)$/] Literal[value=/\\.{3}/]',
4254
message: 'Use ellipsis character (…) in place of three dots',

0 commit comments

Comments
 (0)