Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Eslint): Update to Eslint 6 #254

Merged
merged 1 commit into from May 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -22,7 +22,7 @@
"common-tags": "^1.4.0",
"core-js": "^3.1.4",
"dlv": "^1.1.0",
"eslint": "^5.0.0",
"eslint": "^6.5.1",
"indent-string": "^4.0.0",
"lodash.merge": "^4.6.0",
"loglevel-colored-level-prefix": "^1.0.0",
Expand Down
4 changes: 3 additions & 1 deletion src/__tests__/index.js
Expand Up @@ -353,8 +353,10 @@ test('reads text from fs if filePath is provided but not text', () => {
format({ filePath });
// format({filePath}).catch(() => {})
// one hit to get the file and one for the eslintignore
expect(fsMock.readFileSync).toHaveBeenCalledTimes(2);
expect(fsMock.readFileSync).toHaveBeenCalledTimes(3);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently any call to CLIEngine(eslintOptions) where eslintOptions doesn't contain a cwd nor a ignore set to false, will lead to reading the eslintignore twice now.

expect(fsMock.readFileSync).toHaveBeenCalledWith(filePath, 'utf8');
const eslintIgnoreCall = fsMock.readFileSync.mock.calls[1][0];
expect(eslintIgnoreCall.includes('.eslintignore')).toBeTruthy();
});

test('logs error if it cannot read the file from the filePath', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/utils.js
Expand Up @@ -75,7 +75,7 @@ function getOptionsForFormatting(
}

function getRelevantESLintConfig(eslintConfig, eslintPath) {
const cliEngine = getESLintCLIEngine(eslintPath);
const cliEngine = getESLintCLIEngine(eslintPath, { ignore: false });

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this result in ignored files being formatted?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. It will just reduce the the unnecessary readings of the ignorefiles

// TODO: Actually test this branch
// istanbul ignore next
const loadedRules =
Expand Down