Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(eslint): 新规则:no-spread-in-props
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
packages/eslint-plugin-taro/rules/custom/no-spread-in-props.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const { buildDocsMeta } = require('../../utils/utils') | ||
|
||
const ERROR_MESSAGE = '不能在 JSX 参数中使用对象展开符(Object spread)' | ||
|
||
module.exports = { | ||
meta: { | ||
docs: buildDocsMeta(ERROR_MESSAGE, 'no-spread-in-props') | ||
}, | ||
|
||
create (context) { | ||
return { | ||
JSXSpreadAttribute (node) { | ||
context.report({ | ||
message: ERROR_MESSAGE, | ||
node | ||
}) | ||
} | ||
} | ||
} | ||
} |