Skip to content

Commit 9a6c7f4

Browse files
Chore: use eslint-plugin-self for linting
1 parent 5404254 commit 9a6c7f4

File tree

5 files changed

+20
-15
lines changed

5 files changed

+20
-15
lines changed

.eslintrc.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
'use strict';
22

3-
// Register ourselves as a plugin to avoid `node_modules` trickery.
4-
const Plugins = require('eslint/lib/config/plugins');
5-
Plugins.define('prettier', require('.'));
6-
73
module.exports = {
8-
plugins: ['node', 'eslint-plugin', 'prettier'],
4+
plugins: ['node', 'eslint-plugin', 'self'],
95
extends: [
106
'not-an-aardvark/node',
117
'plugin:node/recommended',
@@ -15,7 +11,7 @@ module.exports = {
1511
env: { mocha: true },
1612
root: true,
1713
rules: {
18-
'prettier/prettier': ['error', { singleQuote: true }],
14+
'self/prettier': ['error', { singleQuote: true }],
1915
'eslint-plugin/report-message-format': ['error', '^[^a-z].*\\.$']
2016
}
2117
};

build/release.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ const CHANGELOG_PATH = path.join(process.cwd(), 'CHANGELOG.md');
1010
const packageFile = require(PACKAGE_JSON_PATH);
1111

1212
function exec(command) {
13-
return childProcess.execSync(command).toString().slice(0, -1);
13+
return childProcess
14+
.execSync(command)
15+
.toString()
16+
.slice(0, -1);
1417
}
1518

1619
const githubRepoUrl = exec('git config --get remote.origin.url').replace(
@@ -48,7 +51,9 @@ function getAbbreviatedCommitHash(commitHash) {
4851
}
4952

5053
function getCommitLink(commitHash) {
51-
return `[${getAbbreviatedCommitHash(commitHash)}](${githubRepoUrl}/commit/${commitHash})`;
54+
return `[${getAbbreviatedCommitHash(
55+
commitHash
56+
)}](${githubRepoUrl}/commit/${commitHash})`;
5257
}
5358

5459
function replaceIssueLinks(message) {

eslint-plugin-prettier.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,10 @@ module.exports = {
306306
]
307307
},
308308
create(context) {
309-
const prettierOptions = context.options[0] === 'fb'
310-
? FB_PRETTIER_OPTIONS
311-
: context.options[0];
309+
const prettierOptions =
310+
context.options[0] === 'fb'
311+
? FB_PRETTIER_OPTIONS
312+
: context.options[0];
312313

313314
const pragma = context.options[1]
314315
? context.options[1].slice(1) // Remove leading @
@@ -326,10 +327,12 @@ module.exports = {
326327
const allComments = sourceCode.getAllComments();
327328
const firstComment = hasShebang ? allComments[1] : allComments[0];
328329
if (
329-
!(firstComment &&
330+
!(
331+
firstComment &&
330332
firstComment.type === 'Block' &&
331333
firstComment.loc.start.line === (hasShebang ? 2 : 1) &&
332-
firstComment.loc.start.column === 0)
334+
firstComment.loc.start.column === 0
335+
)
333336
) {
334337
return {};
335338
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"eslint-config-prettier": "^1.3.0",
3939
"eslint-plugin-eslint-plugin": "^0.7.1",
4040
"eslint-plugin-node": "^4.2.2",
41+
"eslint-plugin-self": "^1.0.1",
4142
"mocha": "^3.1.2",
4243
"moment": "^2.18.1",
4344
"prettier": "^1.3.1",

test/prettier.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ ruleTester.run('prettier', rule, {
3434
// No pragma = No prettier check.
3535
{ code: '""\n', options: [null, '@format'] },
3636
// Facebook style uses single quotes.
37-
{ code: `'';\n`, options: ['fb'] },
37+
{ code: `('');\n`, options: ['fb'] },
3838
// Facebook style but missing pragma.
3939
{ code: `"";\n`, options: ['fb', '@format'] },
4040
// Facebook style with pragma.
41-
{ code: `/** @format */\n'';\n`, options: ['fb', '@format'] },
41+
{ code: `/** @format */\n('');\n`, options: ['fb', '@format'] },
4242
// Shebang with pragma.
4343
{ code: `#!/bin/node\n/** @format */\n"";\n`, options: [null, '@format'] }
4444
],

0 commit comments

Comments
 (0)