Skip to content

Commit

Permalink
[eslint] enable array-bracket-spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jul 26, 2023
1 parent d8002be commit 68bf510
Show file tree
Hide file tree
Showing 23 changed files with 297 additions and 296 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"ecmaVersion": 2020,
},
"rules": {
"array-bracket-spacing": [2, "never"],
"arrow-body-style": [2, "as-needed"],
"arrow-parens": [2, "always"],
"arrow-spacing": [2, { "before": true, "after": true }],
Expand Down
2 changes: 1 addition & 1 deletion src/rules/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { isBuiltIn, isExternalModule, isScoped } from '../core/importType';
import moduleVisitor from 'eslint-module-utils/moduleVisitor';
import docsUrl from '../docsUrl';

const enumValues = { enum: [ 'always', 'ignorePackages', 'never' ] };
const enumValues = { enum: ['always', 'ignorePackages', 'never'] };
const patternProperties = {
type: 'object',
patternProperties: { '.*': enumValues },
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-absolute-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = {
url: docsUrl('no-absolute-path'),
},
fixable: 'code',
schema: [ makeOptionsSchema() ],
schema: [makeOptionsSchema()],
},

create(context) {
Expand Down
8 changes: 4 additions & 4 deletions tests/src/core/hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('hash', function () {
});

it('handles Array instances', function () {
expectHash(hashify([ 'a string' ]), '["a string",]');
expectHash(hashify(['a string']), '["a string",]');
});

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

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

describe('hashArray', function () {
it('handles Array instances', function () {
expectHash(hashArray([ 'a string' ]), '["a string",]');
expectHash(hashArray(['a string']), '["a string",]');
});

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

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

Expand Down
4 changes: 2 additions & 2 deletions tests/src/core/ignore.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('ignore', function () {
});

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

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

Expand All @@ -45,7 +45,7 @@ describe('ignore', function () {
});

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

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

Expand Down
4 changes: 2 additions & 2 deletions tests/src/core/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe('parse(content, { settings, ecmaFeatures })', function () {
const parseSpy = sinon.spy();
const parserOptions = { ecmaFeatures: { jsx: true } };
parseStubParser.parse = parseSpy;
expect(parse.bind(null, path, content, { settings: { 'import/parsers': { [parseStubParserPath]: [ '.js' ] } }, parserPath: null, parserOptions })).not.to.throw(Error);
expect(parse.bind(null, path, content, { settings: { 'import/parsers': { [parseStubParserPath]: ['.js'] } }, parserPath: null, parserOptions })).not.to.throw(Error);
expect(parseSpy.callCount, 'custom parser to be called once').to.equal(1);
});

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

Expand Down
10 changes: 5 additions & 5 deletions tests/src/core/resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe('resolve', function () {
});

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

expect(resolve(
'../files/foo',
Expand All @@ -104,7 +104,7 @@ describe('resolve', function () {
});

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

expect(resolve(
'../files/foo',
Expand Down Expand Up @@ -254,7 +254,7 @@ describe('resolve', function () {
});

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

expect(resolve(
'../files/foo',
Expand All @@ -272,7 +272,7 @@ describe('resolve', function () {
});

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

expect(resolve(
'../files/foo',
Expand Down Expand Up @@ -386,7 +386,7 @@ describe('resolve', function () {
'import/cache': { lifetime: 1 },
});

const infiniteContexts = [ '∞', 'Infinity' ].map((inf) => [inf,
const infiniteContexts = ['∞', 'Infinity'].map((inf) => [inf,
utils.testContext({
'import/cache': { lifetime: inf },
})]);
Expand Down
Loading

0 comments on commit 68bf510

Please sign in to comment.