Skip to content

Commit

Permalink
Code style
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Feb 17, 2020
1 parent fdc1e20 commit 2b08a2a
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions rules/utils/not-dom-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

// AST Types:
// https://github.com/eslint/espree/blob/master/lib/ast-node-types.js#L18
// Only types possible to be `callee` or `argument` listed
const impossibleTypes = [
// Only types possible to be `callee` or `argument` are listed
const impossibleNodeTypes = [
'ArrayExpression',
'ArrowFunctionExpression',
'ClassExpression',
Expand All @@ -15,17 +15,14 @@ const impossibleTypes = [

// We might need this later
/* istanbul ignore next */
const isNotDomNode = node => {
return impossibleTypes.includes(node.type) ||
const isNotDomNode = node =>
impossibleNodeTypes.includes(node.type) ||
(node.type === 'Identifier' && node.name === 'undefined');
};

const notDomNodeSelector = node => {
return [
...impossibleTypes.map(type => `[${node}.type!="${type}"]`),
`:not([${node}.type="Identifier"][${node}.name="undefined"])`
].join('');
};
const notDomNodeSelector = node => [
...impossibleNodeTypes.map(type => `[${node}.type!="${type}"]`),
`:not([${node}.type="Identifier"][${node}.name="undefined"])`
].join('');

module.exports = {
isNotDomNode,
Expand Down

0 comments on commit 2b08a2a

Please sign in to comment.