Skip to content

Commit

Permalink
chore: update devDeps and lint according to eslint config update
Browse files Browse the repository at this point in the history
  • Loading branch information
brettz9 committed Jan 3, 2021
1 parent 590d54e commit f345419
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 32 deletions.
8 changes: 4 additions & 4 deletions package.json
Expand Up @@ -22,22 +22,22 @@
"@babel/preset-env": "^7.12.11",
"@babel/register": "^7.12.10",
"@hkdobrev/run-if-changed": "^0.3.1",
"@typescript-eslint/parser": "^4.10.0",
"@typescript-eslint/parser": "^4.11.1",
"babel-eslint": "^10.1.0",
"babel-plugin-add-module-exports": "^1.0.4",
"babel-plugin-istanbul": "^6.0.0",
"chai": "^4.2.0",
"cross-env": "^7.0.3",
"eslint": "7.16.0",
"eslint-config-canonical": "^24.4.4",
"eslint": "7.17.0",
"eslint-config-canonical": "^25.0.0",
"gitdown": "^3.1.3",
"glob": "^7.1.6",
"husky": "^4.3.6",
"lint-staged": "^10.5.3",
"mocha": "^8.2.1",
"nyc": "^15.1.0",
"rimraf": "^3.0.2",
"semantic-release": "^17.3.0",
"semantic-release": "^17.3.1",
"typescript": "^4.1.3"
},
"engines": {
Expand Down
36 changes: 16 additions & 20 deletions src/exportParser.js
Expand Up @@ -322,10 +322,11 @@ const findNode = function (node, block, cache) {
blockCache = blockCache.slice();
blockCache.push(block);

if (block.type === 'object' || block.type === 'MethodDefinition') {
if (block.value === node) {
return true;
}
if (
(block.type === 'object' || block.type === 'MethodDefinition') &&
block.value === node
) {
return true;
}

const {props = block.body} = block;
Expand Down Expand Up @@ -367,10 +368,8 @@ const findExportedNode = function (block, node, cache) {
const {props} = block;
for (const propval of Object.values(props)) {
blockCache.push(propval);
if (propval.exported) {
if (node === propval.value || findNode(node, propval.value)) {
return true;
}
if (propval.exported && (node === propval.value || findNode(node, propval.value))) {
return true;
}

// No need to check `propval` for exported nodes as ESM
Expand All @@ -381,16 +380,15 @@ const findExportedNode = function (block, node, cache) {
};

const isNodeExported = function (node, globals, opt) {
if (opt.initModuleExports && globals.props.module && globals.props.module.props.exports) {
if (findNode(node, globals.props.module.props.exports)) {
return true;
}
if (
opt.initModuleExports && globals.props.module && globals.props.module.props.exports &&
findNode(node, globals.props.module.props.exports)
) {
return true;
}

if (opt.initWindow && globals.props.window) {
if (findNode(node, globals.props.window)) {
return true;
}
if (opt.initWindow && globals.props.window && findNode(node, globals.props.window)) {
return true;
}

if (opt.esm && findExportedNode(globals, node)) {
Expand All @@ -402,10 +400,8 @@ const isNodeExported = function (node, globals, opt) {

const parseRecursive = function (node, globalVars, opts) {
// Iterate from top using recursion - stop at first processed node from top
if (node.parent) {
if (parseRecursive(node.parent, globalVars, opts)) {
return true;
}
if (node.parent && parseRecursive(node.parent, globalVars, opts)) {
return true;
}

return mapVariables(node, globalVars, opts);
Expand Down
14 changes: 6 additions & 8 deletions src/rules/checkValues.js
Expand Up @@ -85,14 +85,12 @@ export default iterateJsdoc(({
null,
jsdocParameter,
);
} else if (allowedAuthors) {
if (!allowedAuthors.includes(author)) {
report(
`Invalid JSDoc @${targetTagName}: "${jsdocParameter.description}"; expected one of ${allowedAuthors.join(', ')}.`,
null,
jsdocParameter,
);
}
} else if (allowedAuthors && !allowedAuthors.includes(author)) {
report(
`Invalid JSDoc @${targetTagName}: "${jsdocParameter.description}"; expected one of ${allowedAuthors.join(', ')}.`,
null,
jsdocParameter,
);
}
});
}, {
Expand Down

0 comments on commit f345419

Please sign in to comment.