Skip to content

Commit 68bf510

Browse files
committed
[eslint] enable array-bracket-spacing
1 parent d8002be commit 68bf510

23 files changed

+297
-296
lines changed

.eslintrc

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"ecmaVersion": 2020,
2020
},
2121
"rules": {
22+
"array-bracket-spacing": [2, "never"],
2223
"arrow-body-style": [2, "as-needed"],
2324
"arrow-parens": [2, "always"],
2425
"arrow-spacing": [2, { "before": true, "after": true }],

src/rules/extensions.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { isBuiltIn, isExternalModule, isScoped } from '../core/importType';
55
import moduleVisitor from 'eslint-module-utils/moduleVisitor';
66
import docsUrl from '../docsUrl';
77

8-
const enumValues = { enum: [ 'always', 'ignorePackages', 'never' ] };
8+
const enumValues = { enum: ['always', 'ignorePackages', 'never'] };
99
const patternProperties = {
1010
type: 'object',
1111
patternProperties: { '.*': enumValues },

src/rules/no-absolute-path.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = {
1212
url: docsUrl('no-absolute-path'),
1313
},
1414
fixable: 'code',
15-
schema: [ makeOptionsSchema() ],
15+
schema: [makeOptionsSchema()],
1616
},
1717

1818
create(context) {

tests/src/core/hash.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('hash', function () {
2929
});
3030

3131
it('handles Array instances', function () {
32-
expectHash(hashify([ 'a string' ]), '["a string",]');
32+
expectHash(hashify(['a string']), '["a string",]');
3333
});
3434

3535
it('handles empty Array instances', function () {
@@ -45,13 +45,13 @@ describe('hash', function () {
4545
});
4646

4747
it('handles nested Object and Array instances', function () {
48-
expectHash(hashify({ foo: 123.456, 'a key': 'a value', obj: { arr: [ { def: 'ghi' } ] } }), '{"a key":"a value","foo":123.456,"obj":{"arr":[{"def":"ghi",},],},}');
48+
expectHash(hashify({ foo: 123.456, 'a key': 'a value', obj: { arr: [{ def: 'ghi' }] } }), '{"a key":"a value","foo":123.456,"obj":{"arr":[{"def":"ghi",},],},}');
4949
});
5050
});
5151

5252
describe('hashArray', function () {
5353
it('handles Array instances', function () {
54-
expectHash(hashArray([ 'a string' ]), '["a string",]');
54+
expectHash(hashArray(['a string']), '["a string",]');
5555
});
5656

5757
it('handles empty Array instances', function () {
@@ -69,7 +69,7 @@ describe('hash', function () {
6969
});
7070

7171
it('handles nested Object and Array instances', function () {
72-
expectHash(hashObject({ foo: 123.456, 'a key': 'a value', obj: { arr: [ { def: 'ghi' } ] } }), '{"a key":"a value","foo":123.456,"obj":{"arr":[{"def":"ghi",},],},}');
72+
expectHash(hashObject({ foo: 123.456, 'a key': 'a value', obj: { arr: [{ def: 'ghi' }] } }), '{"a key":"a value","foo":123.456,"obj":{"arr":[{"def":"ghi",},],},}');
7373
});
7474
});
7575

tests/src/core/ignore.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('ignore', function () {
1919
});
2020

2121
it('ignores paths with invalid extensions when configured with import/extensions', function () {
22-
const testContext = utils.testContext({ 'import/extensions': [ '.js', '.jsx', '.ts' ] });
22+
const testContext = utils.testContext({ 'import/extensions': ['.js', '.jsx', '.ts'] });
2323

2424
expect(isIgnored('../files/foo.js', testContext)).to.equal(false);
2525

@@ -45,7 +45,7 @@ describe('ignore', function () {
4545
});
4646

4747
it('can be configured with import/extensions', function () {
48-
const testContext = utils.testContext({ 'import/extensions': [ '.foo', '.bar' ] });
48+
const testContext = utils.testContext({ 'import/extensions': ['.foo', '.bar'] });
4949

5050
expect(hasValidExtension('../files/foo.foo', testContext)).to.equal(true);
5151

tests/src/core/parse.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ describe('parse(content, { settings, ecmaFeatures })', function () {
7676
const parseSpy = sinon.spy();
7777
const parserOptions = { ecmaFeatures: { jsx: true } };
7878
parseStubParser.parse = parseSpy;
79-
expect(parse.bind(null, path, content, { settings: { 'import/parsers': { [parseStubParserPath]: [ '.js' ] } }, parserPath: null, parserOptions })).not.to.throw(Error);
79+
expect(parse.bind(null, path, content, { settings: { 'import/parsers': { [parseStubParserPath]: ['.js'] } }, parserPath: null, parserOptions })).not.to.throw(Error);
8080
expect(parseSpy.callCount, 'custom parser to be called once').to.equal(1);
8181
});
8282

@@ -123,7 +123,7 @@ describe('parse(content, { settings, ecmaFeatures })', function () {
123123
it('prefers parsers specified in the settings over languageOptions.parser', () => {
124124
const parseSpy = sinon.spy();
125125
parseStubParser.parse = parseSpy;
126-
expect(parse.bind(null, path, content, { settings: { 'import/parsers': { [parseStubParserPath]: [ '.js' ] } }, parserPath: null, languageOptions: { parser: { parse() {} } } })).not.to.throw(Error);
126+
expect(parse.bind(null, path, content, { settings: { 'import/parsers': { [parseStubParserPath]: ['.js'] } }, parserPath: null, languageOptions: { parser: { parse() {} } } })).not.to.throw(Error);
127127
expect(parseSpy.callCount, 'custom parser to be called once').to.equal(1);
128128
});
129129

tests/src/core/resolve.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ describe('resolve', function () {
8686
});
8787

8888
it('respects import/resolver as array of strings', function () {
89-
const testContext = utils.testContext({ 'import/resolver': [ './foo-bar-resolver-v2', './foo-bar-resolver-v1' ] });
89+
const testContext = utils.testContext({ 'import/resolver': ['./foo-bar-resolver-v2', './foo-bar-resolver-v1'] });
9090

9191
expect(resolve(
9292
'../files/foo',
@@ -104,7 +104,7 @@ describe('resolve', function () {
104104
});
105105

106106
it('respects import/resolver as array of objects', function () {
107-
const testContext = utils.testContext({ 'import/resolver': [ { './foo-bar-resolver-v2': {} }, { './foo-bar-resolver-v1': {} } ] });
107+
const testContext = utils.testContext({ 'import/resolver': [{ './foo-bar-resolver-v2': {} }, { './foo-bar-resolver-v1': {} }] });
108108

109109
expect(resolve(
110110
'../files/foo',
@@ -254,7 +254,7 @@ describe('resolve', function () {
254254
});
255255

256256
it('respects import/resolver as array of strings', function () {
257-
const testContext = utils.testContext({ 'import/resolver': [ './foo-bar-resolver-v2', './foo-bar-resolver-v1' ] });
257+
const testContext = utils.testContext({ 'import/resolver': ['./foo-bar-resolver-v2', './foo-bar-resolver-v1'] });
258258

259259
expect(resolve(
260260
'../files/foo',
@@ -272,7 +272,7 @@ describe('resolve', function () {
272272
});
273273

274274
it('respects import/resolver as array of objects', function () {
275-
const testContext = utils.testContext({ 'import/resolver': [ { './foo-bar-resolver-v2': {} }, { './foo-bar-resolver-v1': {} } ] });
275+
const testContext = utils.testContext({ 'import/resolver': [{ './foo-bar-resolver-v2': {} }, { './foo-bar-resolver-v1': {} }] });
276276

277277
expect(resolve(
278278
'../files/foo',
@@ -386,7 +386,7 @@ describe('resolve', function () {
386386
'import/cache': { lifetime: 1 },
387387
});
388388

389-
const infiniteContexts = [ '∞', 'Infinity' ].map((inf) => [inf,
389+
const infiniteContexts = ['∞', 'Infinity'].map((inf) => [inf,
390390
utils.testContext({
391391
'import/cache': { lifetime: inf },
392392
})]);

0 commit comments

Comments
 (0)