Skip to content

Commit

Permalink
[eslint] clean up config
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jun 23, 2024
1 parent be8136f commit e7bdf65
Show file tree
Hide file tree
Showing 16 changed files with 435 additions and 887 deletions.
18 changes: 12 additions & 6 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
{
"extends": [
"eslint:recommended",
"@ljharb/eslint-config/esm",
"plugin:flowtype/recommended"
],
"parser": "@babel/eslint-parser",
"parserOptions": {
"sourceType": "module",
},
"env": {
"es6": true
"es6": true,
},
"parser": "@babel/eslint-parser",
"plugins": [
"flowtype"
],
"rules": {
"indent": [2, 2],
},
"overrides": [
{
"files": [
Expand All @@ -24,11 +30,11 @@
"__tests__/**/*.js"
],
"extends": [
"eslint:recommended",
"@ljharb/eslint-config/tests",
],
"env": {
"node": true
}
"node": true,
},
}
]
}
6 changes: 3 additions & 3 deletions __tests__/src/AXObjectElementMap-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ test('AXObjectElementMap', async (t) => {
}

[...AXObjectElementMap.keys()].forEach(([key]) => {
s2t.ok(entriesKeys.find(([k]) => k === key), `spread has key: ${key}`);
s2t.ok(entriesKeys.find(([k]) => k === key), `spread has key: ${key}`);
});
});

Expand All @@ -230,14 +230,14 @@ test('AXObjectElementMap', async (t) => {
for (const values of AXObjectElementMap.values()) {
s2t.ok(
entriesValues.some((vs) => deepEqual(values, vs)),
`for-of has values: ${inspect(values)}`
`for-of has values: ${inspect(values)}`,
);
}

[...AXObjectElementMap.values()].forEach((values) => {
s2t.ok(
entriesValues.some((vs) => deepEqual(values, vs)),
`spread has values: ${inspect(values)}`
`spread has values: ${inspect(values)}`,
);
});
});
Expand Down
6 changes: 3 additions & 3 deletions __tests__/src/AXObjectRoleMap-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ test('AXObjectRoleMap', async (t) => {
}

[...AXObjectRoleMap.keys()].forEach(([key]) => {
s2t.ok(entriesKeys.find(([k]) => k === key), `spread has key: ${key}`);
s2t.ok(entriesKeys.find(([k]) => k === key), `spread has key: ${key}`);
});
});

Expand All @@ -241,14 +241,14 @@ test('AXObjectRoleMap', async (t) => {
for (const values of AXObjectRoleMap.values()) {
s2t.ok(
entriesValues.some((vs) => deepEqual(values, vs)),
`for-of has values: ${inspect(values)}`
`for-of has values: ${inspect(values)}`,
);
}

[...AXObjectRoleMap.values()].forEach((values) => {
s2t.ok(
entriesValues.some((vs) => deepEqual(values, vs)),
`spread has values: ${inspect(values)}`
`spread has values: ${inspect(values)}`,
);
});
});
Expand Down
500 changes: 250 additions & 250 deletions __tests__/src/AXObjectsMap-test.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions __tests__/src/elementAXObjectMap-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const entriesList = [
];

test('elementAXObjectMap', async (t) => {
t.test('iteration', (st) => {
t.test('iteration', (st) => {

st.notEqual(elementAXObjectMap[Symbol.iterator], undefined, 'has an iterator defined');
st.equal([...elementAXObjectMap].length, 70, 'has a specific length');
Expand Down Expand Up @@ -243,7 +243,7 @@ test('elementAXObjectMap', async (t) => {
}

[...elementAXObjectMap.keys()].forEach((key) => {
s2t.ok(entriesKeys.find((k) => deepEqual(k, key)), `spread has key: ${inspect(key)}`);
s2t.ok(entriesKeys.find((k) => deepEqual(k, key)), `spread has key: ${inspect(key)}`);
});
});

Expand All @@ -254,14 +254,14 @@ test('elementAXObjectMap', async (t) => {
for (const values of elementAXObjectMap.values()) {
s2t.ok(
entriesValues.some((vs) => deepEqual(values, vs)),
`for-of has values: ${inspect(values)}`
`for-of has values: ${inspect(values)}`,
);
}

[...elementAXObjectMap.values()].forEach((values) => {
s2t.ok(
entriesValues.some((vs) => deepEqual(values, vs)),
`spread has values: ${inspect(values)}`
`spread has values: ${inspect(values)}`,
);
});
});
Expand Down
20 changes: 10 additions & 10 deletions __tests__/src/util/iterationDecorator-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import iterationDecorator from 'axobject-query/src/util/iterationDecorator';

test('iterationDecorator', (t) => {
t.test('adds a Symbol.iterator property to a collection', async (st) => {
// const collection = {a: 'apple', b: 'banana', c: 'cantaloupe'};
const collection = {
'a': 'apple',
'b': 'banana',
'c': 'cantaloupe',
};
const arr = ['apple', 'banana', 'cantaloupe'];
const iter = iterationDecorator(collection, values(collection));
st.deepEqual([...iter], arr, 'returns the values when iterated');
// const collection = {a: 'apple', b: 'banana', c: 'cantaloupe'};
const collection = {
'a': 'apple',
'b': 'banana',
'c': 'cantaloupe',
};
const arr = ['apple', 'banana', 'cantaloupe'];
const iter = iterationDecorator(collection, values(collection));
st.deepEqual([...iter], arr, 'returns the values when iterated');
});

t.test('when Symbol is not defined in the global space', async (st) => {
Expand All @@ -32,7 +32,7 @@ test('iterationDecorator', (t) => {

t.test('when Symbol.iterator is not defined in the global space', async (st) => {
const originalSymbolIterator = typeof Symbol === 'function' ? Symbol.iterator : null;
st.teardown(mockProperty(global, 'Symbol', { value: function () {} }));
st.teardown(mockProperty(global, 'Symbol', { value () {} }));

const collection = {
'a': 'apple',
Expand Down
2 changes: 1 addition & 1 deletion __tests__/src/util/iteratorProxy-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import iteratorProxy from 'axobject-query/src/util/iteratorProxy';
test('iteratorProxy', async (t) => {
const arr = ['a', 'b', 'c'];
const iter = {
[Symbol.iterator]: iteratorProxy.bind(arr)
[Symbol.iterator]: iteratorProxy.bind(arr),
};

t.deepEqual([...iter], arr, 'creates an iterator for the bound array');
Expand Down
Loading

0 comments on commit e7bdf65

Please sign in to comment.