Skip to content

Commit

Permalink
Replace SourceCodeFixer.applyFixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Sep 18, 2021
1 parent 5d16a1b commit 5e2c671
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 158 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@
"ignores": [
".cache-eslint-remote-tester",
"eslint-remote-tester-results",
"test/integration/{fixtures,fixtures-local}/**",
"test/utils/source-code-fixer.mjs"
"test/integration/{fixtures,fixtures-local}/**"
],
"rules": {
"unicorn/no-null": "error"
Expand Down
7 changes: 4 additions & 3 deletions test/utils/snapshot-rule-tester.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import {createRequire} from 'node:module';
import {Linter} from 'eslint';
import {codeFrameColumns} from '@babel/code-frame';
import outdent from 'outdent';
// TODO: Find a better way to test output.
import SourceCodeFixer from './source-code-fixer.mjs';

const require = createRequire(import.meta.url);
const codeFrameColumnsOptions = {linesAbove: Number.POSITIVE_INFINITY, linesBelow: Number.POSITIVE_INFINITY};
Expand Down Expand Up @@ -186,7 +184,10 @@ class SnapshotRuleTester {
}

for (const [index, suggestion] of suggestions.entries()) {
const {output} = SourceCodeFixer.applyFixes(code, [suggestion]);
// https://github.com/eslint/eslint/issues/14936#issuecomment-906746754
const { fix } = suggestion;
const output = `${code.slice(0, fix.range[0])}${fix.text}${code.slice(fix.range[1])}`;

messageForSnapshot += outdent`
\n
${'-'.repeat(80)}
Expand Down
153 changes: 0 additions & 153 deletions test/utils/source-code-fixer.mjs

This file was deleted.

0 comments on commit 5e2c671

Please sign in to comment.