Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Chore: update no-unused-vars caughtErrors in eslint-config-eslint (#1…
  • Loading branch information
mdjermanovic committed Jun 1, 2020
1 parent 426088c commit 578efad
Show file tree
Hide file tree
Showing 20 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions lib/cli-engine/cli-engine.js
Expand Up @@ -403,7 +403,7 @@ function getCacheFile(cacheFile, cwd) {

try {
fileStats = fs.lstatSync(resolvedCacheFile);
} catch (ex) {
} catch {
fileStats = null;
}

Expand Down Expand Up @@ -991,7 +991,7 @@ class CLIEngine {
const npmFormat = naming.normalizePackageName(normalizedFormatName, "eslint-formatter");

formatterPath = ModuleResolver.resolve(npmFormat, path.join(cwd, "__placeholder__.js"));
} catch (e) {
} catch {
formatterPath = path.resolve(__dirname, "formatters", normalizedFormatName);
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/cli-engine/config-array-factory.js
Expand Up @@ -517,7 +517,7 @@ class ConfigArrayFactory {
try {
loadPackageJSONConfigFile(filePath);
return filePath;
} catch (error) { /* ignore */ }
} catch { /* ignore */ }
} else {
return filePath;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/init/config-initializer.js
Expand Up @@ -350,7 +350,7 @@ function getLocalESLintVersion() {
const eslint = require(eslintPath);

return eslint.linter.version || null;
} catch (_err) {
} catch {
return null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/linter/config-comment-parser.js
Expand Up @@ -78,7 +78,7 @@ module.exports = class ConfigCommentParser {
config: items
};
}
} catch (ex) {
} catch {

debug("Levn parsing failed; falling back to manual parsing.");

Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-control-regex.js
Expand Up @@ -35,7 +35,7 @@ const collector = new (class {
try {
this._source = regexpStr;
this._validator.validatePattern(regexpStr); // Call onCharacter hook
} catch (err) {
} catch {

// Ignore syntax errors in RegExp.
}
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-invalid-regexp.js
Expand Up @@ -93,7 +93,7 @@ module.exports = {
try {
validator.validateFlags(flags);
return null;
} catch (err) {
} catch {
return `Invalid flags supplied to RegExp constructor '${flags}'`;
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-misleading-character-class.js
Expand Up @@ -147,7 +147,7 @@ module.exports = {
pattern.length,
flags.includes("u")
);
} catch (e) {
} catch {

// Ignore regular expressions with syntax errors
return;
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-regex-spaces.js
Expand Up @@ -76,7 +76,7 @@ module.exports = {

try {
regExpAST = regExpParser.parsePattern(pattern, 0, pattern.length, flags.includes("u"));
} catch (e) {
} catch {

// Ignore regular expressions with syntax errors
return;
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-useless-backreference.js
Expand Up @@ -95,7 +95,7 @@ module.exports = {

try {
regExpAST = parser.parsePattern(pattern, 0, pattern.length, flags.includes("u"));
} catch (e) {
} catch {

// Ignore regular expressions with syntax errors
return;
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/prefer-named-capture-group.js
Expand Up @@ -59,7 +59,7 @@ module.exports = {

try {
ast = parser.parsePattern(pattern, 0, pattern.length, uFlag);
} catch (_) {
} catch {

// ignore regex syntax errors
return;
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/quote-props.js
Expand Up @@ -154,7 +154,7 @@ module.exports = {

try {
tokens = espree.tokenize(key.value);
} catch (e) {
} catch {
return;
}

Expand Down Expand Up @@ -239,7 +239,7 @@ module.exports = {

try {
tokens = espree.tokenize(key.value);
} catch (e) {
} catch {
necessaryQuotes = true;
return;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/utils/ast-utils.js
Expand Up @@ -1415,7 +1415,7 @@ module.exports = {

try {
tokens = espree.tokenize(leftValue, espreeOptions);
} catch (e) {
} catch {
return false;
}

Expand Down Expand Up @@ -1444,7 +1444,7 @@ module.exports = {

try {
tokens = espree.tokenize(rightValue, espreeOptions);
} catch (e) {
} catch {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config-eslint/default.yml
Expand Up @@ -134,7 +134,7 @@ rules:
no-unmodified-loop-condition: "error"
no-unneeded-ternary: "error"
no-unused-expressions: "error"
no-unused-vars: ["error", {vars: "all", args: "after-used"}]
no-unused-vars: ["error", {vars: "all", args: "after-used", caughtErrors: "all"}]
no-use-before-define: "error"
no-useless-call: "error"
no-useless-computed-key: "error"
Expand Down
2 changes: 1 addition & 1 deletion tests/_utils/in-memory-fs.js
Expand Up @@ -111,7 +111,7 @@ const context = vm.createContext();
function isExistingFile(fs, filePath) {
try {
return fs.statSync(filePath).isFile();
} catch (error) {
} catch {
return false;
}
}
Expand Down
6 changes: 3 additions & 3 deletions tests/lib/cli-engine/cli-engine.js
Expand Up @@ -58,7 +58,7 @@ describe("CLIEngine", () => {

try {
return fs.realpathSync(filepath);
} catch (e) {
} catch {
return filepath;
}
}
Expand Down Expand Up @@ -2161,7 +2161,7 @@ describe("CLIEngine", () => {
function doDelete(filePath) {
try {
fs.unlinkSync(filePath);
} catch (ex) {
} catch {

/*
* we don't care if the file didn't exist, since our
Expand Down Expand Up @@ -2197,7 +2197,7 @@ describe("CLIEngine", () => {
function deleteCacheDir() {
try {
fs.unlinkSync("./tmp/.cacheFileDir/.cache_hashOfCurrentWorkingDirectory");
} catch (ex) {
} catch {

/*
* we don't care if the file didn't exist, since our
Expand Down
6 changes: 3 additions & 3 deletions tests/lib/eslint/eslint.js
Expand Up @@ -55,7 +55,7 @@ describe("ESLint", () => {

try {
return fs.realpathSync(filepath);
} catch (e) {
} catch {
return filepath;
}
}
Expand Down Expand Up @@ -2102,7 +2102,7 @@ describe("ESLint", () => {
function doDelete(filePath) {
try {
fs.unlinkSync(filePath);
} catch (ex) {
} catch {

/*
* we don't care if the file didn't exist, since our
Expand Down Expand Up @@ -2138,7 +2138,7 @@ describe("ESLint", () => {
function deleteCacheDir() {
try {
fs.unlinkSync("./tmp/.cacheFileDir/.cache_hashOfCurrentWorkingDirectory");
} catch (ex) {
} catch {

/*
* we don't care if the file didn't exist, since our
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/init/config-initializer.js
Expand Up @@ -67,7 +67,7 @@ describe("configInitializer", () => {

try {
return fs.realpathSync(filepath);
} catch (e) {
} catch {
return filepath;
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/init/source-code-utils.js
Expand Up @@ -41,7 +41,7 @@ describe("SourceCodeUtil", () => {
try {
filepath = fs.realpathSync(filepath);
return filepath;
} catch (e) {
} catch {
return filepath;
}
}
Expand Down
2 changes: 1 addition & 1 deletion tools/code-sample-minimizer.js
Expand Up @@ -76,7 +76,7 @@ function reduceBadExampleSize({
function reproducesBadCase(updatedSourceText) {
try {
parser.parse(updatedSourceText);
} catch (err) {
} catch {
return false;
}

Expand Down
8 changes: 4 additions & 4 deletions tools/eslint-fuzzer.js
Expand Up @@ -65,7 +65,7 @@ function fuzz(options) {

try {
fixResult = linter.verifyAndFix(text, reducedConfig, {});
} catch (err) {
} catch {
return reducedConfig;
}

Expand All @@ -91,7 +91,7 @@ function fuzz(options) {

try {
messages = linter.verify(currentText, config);
} catch (err) {
} catch {
return currentText;
}

Expand Down Expand Up @@ -150,7 +150,7 @@ function fuzz(options) {
try {
linter.verify(reducedText, smallConfig);
return false;
} catch (_) {
} catch {
return true;
}
}
Expand All @@ -172,7 +172,7 @@ function fuzz(options) {
const smallFixResult = linter.verifyAndFix(reducedText, smallConfig);

return smallFixResult.fixed && smallFixResult.messages.length === 1 && smallFixResult.messages[0].fatal;
} catch (_) {
} catch {
return false;
}
}
Expand Down

0 comments on commit 578efad

Please sign in to comment.