Skip to content

Commit

Permalink
Merge pull request #48 from fketchakeu/upgrade_to_eslint6
Browse files Browse the repository at this point in the history
Upgrade to eslint 6
  • Loading branch information
jthomerson committed Jan 22, 2020
2 parents 9a6e324 + 3c56be6 commit 2aa0024
Show file tree
Hide file tree
Showing 8 changed files with 1,332 additions and 1,167 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ Next, install `@silvermine/eslint-plugin-silvermine`:
$ npm install @silvermine/eslint-plugin-silvermine --save-dev
```

**Note:** If you installed ESLint globally (using the `-g` flag) then you must also install `@silvermine/eslint-plugin-silvermine` globally.

## Usage

Add `silvermine` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:
Expand Down
13 changes: 8 additions & 5 deletions lib/rules/brace-style.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* Forked from https://github.com/eslint/eslint/blob/v5.11.1/lib/rules/brace-style.js
* With the following changes applied: https://github.com/eslint/eslint/compare/bf5bfa5..9738f8c
* This modification adds the ability to allow single line, block style arrow functions.
* For example:
*
Expand Down Expand Up @@ -41,9 +42,11 @@ module.exports = {
properties: {
allowSingleLine: {
type: 'boolean',
default: false,
},
allowSingleLineArrow: {
type: 'boolean',
default: false,
},
},
additionalProperties: false,
Expand Down Expand Up @@ -85,7 +88,7 @@ module.exports = {
if (textBetween.trim()) {
return null;
}
return (fixer) => fixer.replaceTextRange(textRange, ' ');
return (fixer) => { return fixer.replaceTextRange(textRange, ' '); };
}

/**
Expand Down Expand Up @@ -114,7 +117,7 @@ module.exports = {
context.report({
node: openingCurly,
messageId: 'sameLineOpen',
fix: (fixer) => fixer.insertTextBefore(openingCurly, '\n'),
fix: (fixer) => { return fixer.insertTextBefore(openingCurly, '\n'); },
});
}

Expand All @@ -123,15 +126,15 @@ module.exports = {
context.report({
node: openingCurly,
messageId: 'blockSameLine',
fix: (fixer) => fixer.insertTextAfter(openingCurly, '\n'),
fix: (fixer) => { return fixer.insertTextAfter(openingCurly, '\n'); },
});
}

if (tokenBeforeClosingCurly !== openingCurly && !singleLineException && isClosingCurlyOnSameLine) {
context.report({
node: closingCurly,
messageId: 'singleLineClose',
fix: (fixer) => fixer.insertTextBefore(closingCurly, '\n'),
fix: (fixer) => { return fixer.insertTextBefore(closingCurly, '\n'); },
});
}
}
Expand All @@ -158,7 +161,7 @@ module.exports = {
context.report({
node: curlyToken,
messageId: 'sameLineClose',
fix: (fixer) => fixer.insertTextAfter(curlyToken, '\n'),
fix: (fixer) => { return fixer.insertTextAfter(curlyToken, '\n'); },
});
}
}
Expand Down
Loading

0 comments on commit 2aa0024

Please sign in to comment.