Skip to content

Commit

Permalink
feat(eslint): 新规则: no-ref
Browse files Browse the repository at this point in the history
  • Loading branch information
yuche committed May 24, 2018
1 parent baf85b7 commit b62dcc2
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/eslint-plugin-taro/rules/custom/no-ref.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const { buildDocsMeta } = require('../../utils/utils')

const ERROR_MESSAGE = '定义 ref 在微信小程序不会起作用'

module.exports = {
meta: {
docs: buildDocsMeta(ERROR_MESSAGE, 'no-jsx-in-props')
},

create (context) {
return {
JSXAttribute (node) {
if (node.name === 'ref') {
context.report({
message: ERROR_MESSAGE,
node
})
}
}
}
}
}

0 comments on commit b62dcc2

Please sign in to comment.