Skip to content

Commit

Permalink
Merge pull request #247 from brettz9/eslint7
Browse files Browse the repository at this point in the history
ESLint 7
  • Loading branch information
lo1tuma authored May 13, 2020
2 parents 7f4b574 + d1bb7bb commit 6012924
Show file tree
Hide file tree
Showing 5 changed files with 269 additions and 105 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [8, 10, 12]
node: [10, 12, 14]
name: Node ${{ matrix.node }}
steps:
- uses: actions/checkout@master
Expand Down
6 changes: 3 additions & 3 deletions lib/rules/no-mocha-arrows.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = {
}

if (fn.params.length > 0) {
paramsFullText = `(${ sourceCode.text.slice(fn.params[0].start, last(fn.params).end) })`;
paramsFullText = `(${ sourceCode.text.slice(fn.params[0].range[0], last(fn.params).range[1]) })`;
}

return `${functionKeyword}${paramsFullText} `;
Expand All @@ -41,14 +41,14 @@ module.exports = {
// When it((...) => { ... }),
// simply replace '(...) => ' with 'function () '
return fixer.replaceTextRange(
[ fn.start, fn.body.start ],
[ fn.range[0], fn.body.range[0] ],
formatFunctionHead(fn)
);
}

const bodyText = sourceCode.text.slice(fn.body.range[0], fn.body.range[1]);
return fixer.replaceTextRange(
[ fn.start, fn.end ],
[ fn.range[0], fn.range[1] ],
`${formatFunctionHead(fn)}{ return ${ bodyText }; }`
);
}
Expand Down
Loading

0 comments on commit 6012924

Please sign in to comment.