Skip to content

Commit db85633

Browse files
Chore: pin the version of prettier used to lint this module (refs #1)
1 parent 090e1c5 commit db85633

File tree

5 files changed

+13
-9
lines changed

5 files changed

+13
-9
lines changed

.eslintrc.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
'use strict';
2+
23
const fs = require('fs');
34
const path = require('path');
45
const PACKAGE_NAME = require('./package').name;
@@ -10,16 +11,16 @@ if (!fs.existsSync(SYMLINK_LOCATION)) {
1011
}
1112

1213
module.exports = {
13-
plugins: [ 'node', 'eslint-plugin', PACKAGE_NAME ],
14+
plugins: ['node', 'eslint-plugin', PACKAGE_NAME],
1415
extends: [
1516
'not-an-aardvark/node',
1617
'plugin:node/recommended',
1718
'plugin:eslint-plugin/recommended'
1819
],
1920
root: true,
2021
rules: {
21-
'prettier/prettier': [ 'error', { singleQuote: true } ],
22-
'eslint-plugin/report-message-format': [ 'error', '^[^a-z].*\\.$' ],
22+
'prettier/prettier': ['error', { singleQuote: true }],
23+
'eslint-plugin/report-message-format': ['error', '^[^a-z].*\\.$'],
2324
'array-bracket-spacing': 'off',
2425
'comma-dangle': 'off',
2526
'lines-around-directive': 'off',

lib/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* @author Teddy Katz
44
*/
55
'use strict';
6+
67
// ------------------------------------------------------------------------------
78
// Requirements
89
// ------------------------------------------------------------------------------

lib/rules/prettier.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* @author Teddy Katz
44
*/
55
'use strict';
6+
67
const util = require('util');
78
const prettier = require('prettier');
89
const astUtils = require('eslint/lib/ast-utils');
@@ -11,7 +12,7 @@ const astUtils = require('eslint/lib/ast-utils');
1112
// Rule Definition
1213
// ------------------------------------------------------------------------------
1314
module.exports = {
14-
meta: { fixable: 'code', schema: [ { type: 'object' } ] },
15+
meta: { fixable: 'code', schema: [{ type: 'object' }] },
1516
create(context) {
1617
const sourceCode = context.getSourceCode();
1718

@@ -35,8 +36,8 @@ module.exports = {
3536
const foundChar = firstBadIndex >= sourceCode.text.length
3637
? 'EOF'
3738
: firstBadIndex === -1
38-
? sourceCode.text[desiredText.length]
39-
: sourceCode.text[firstBadIndex];
39+
? sourceCode.text[desiredText.length]
40+
: sourceCode.text[firstBadIndex];
4041

4142
context.report({
4243
loc: astUtils.getLocationFromRangeIndex(
@@ -49,7 +50,7 @@ module.exports = {
4950
foundChar: util.inspect(foundChar)
5051
},
5152
fix: fixer =>
52-
fixer.replaceTextRange([ 0, sourceCode.text.length ], desiredText)
53+
fixer.replaceTextRange([0, sourceCode.text.length], desiredText)
5354
});
5455
}
5556
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"eslint-plugin-eslint-plugin": "^0.2.1",
3535
"eslint-plugin-node": "^3.0.5",
3636
"mocha": "^3.1.2",
37-
"prettier": ">= 0.11.0"
37+
"prettier": "^0.13.1"
3838
},
3939
"engines": {
4040
"node": ">=4.0.0"

tests/lib/rules/prettier.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* @author Teddy Katz
44
*/
55
'use strict';
6+
67
// ------------------------------------------------------------------------------
78
// Requirements
89
// ------------------------------------------------------------------------------
@@ -19,7 +20,7 @@ ruleTester.run('prettier', rule, {
1920
valid: [
2021
'foo(bar);\n',
2122
'foo("bar");\n',
22-
{ code: "foo('bar');\n", options: [ { singleQuote: true } ] }
23+
{ code: "foo('bar');\n", options: [{ singleQuote: true }] }
2324
],
2425
invalid: [
2526
{

0 commit comments

Comments
 (0)