-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add rule for no-fx-interval and include in deprecated-3.0 (#47)
Part of #32
- Loading branch information
1 parent
d86ac30
commit 87c753c
Showing
4 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
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
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
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,24 @@ | ||
'use strict' | ||
|
||
module.exports = { | ||
meta: { | ||
docs: {}, | ||
schema: [] | ||
}, | ||
|
||
create: function(context) { | ||
return { | ||
MemberExpression: function(node) { | ||
if (node.object.name !== '$') return | ||
if (node.property.name !== 'fx') return | ||
if (!node.parent.property) return | ||
if (node.parent.property.name !== 'interval') return | ||
|
||
context.report({ | ||
node: node, | ||
message: '$.fx.interval is not allowed' | ||
}) | ||
} | ||
} | ||
} | ||
} |
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,17 @@ | ||
'use strict' | ||
|
||
const rule = require('../rules/no-fx-interval') | ||
const RuleTester = require('eslint').RuleTester | ||
|
||
const error = '$.fx.interval is not allowed' | ||
|
||
const ruleTester = new RuleTester() | ||
ruleTester.run('no-noop', rule, { | ||
valid: ['interval', 'fx.interval', '$.interval', 'a.fx.interval', '$.fx'], | ||
invalid: [ | ||
{ | ||
code: '$.fx.interval', | ||
errors: [{message: error, type: 'MemberExpression'}] | ||
} | ||
] | ||
}) |