Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests(eslint): add import/order rule for core tests #13955

Merged
merged 6 commits into from
May 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
28 changes: 28 additions & 0 deletions lighthouse-core/test/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* @license Copyright 2022 The Lighthouse Authors. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/

module.exports = {
rules: {
// TODO(esmodules): move to root eslint when all code is ESM
// or when this is resolved: https://github.com/import-js/eslint-plugin-import/issues/2214
'import/order': [2, {
'groups': [
'builtin',
'external',
['sibling', 'parent'],
'index',
'object',
'type',
],
'newlines-between': 'always',
}],
'import/group-exports': 2,
'import/exports-last': 2,
},
parserOptions: {
sourceType: 'module',
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
'use strict';

import Audit from '../../../audits/accessibility/aria-allowed-attr.js';

import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/aria-allowed-attr.js';

/* eslint-env jest */

describe('Accessibility: aria-allowed-attr audit', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
'use strict';

import Audit from '../../../audits/accessibility/aria-required-attr.js';

import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/aria-required-attr.js';

/* eslint-env jest */

describe('Accessibility: aria-required-attr audit', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
'use strict';

import Audit from '../../../audits/accessibility/aria-required-children.js';

import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/aria-required-children.js';

/* eslint-env jest */

describe('Accessibility: aria-required-children audit', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
'use strict';

import Audit from '../../../audits/accessibility/aria-required-parent.js';

import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/aria-required-parent.js';

/* eslint-env jest */

describe('Accessibility: aria-required-parent audit', () => {
Expand Down
5 changes: 3 additions & 2 deletions lighthouse-core/test/audits/accessibility/aria-roles-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
'use strict';

import Audit from '../../../audits/accessibility/aria-roles.js';

import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/aria-roles.js';

/* eslint-env jest */

describe('Accessibility: aria-roles audit', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
'use strict';

import Audit from '../../../audits/accessibility/aria-valid-attr.js';

import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/aria-valid-attr.js';

/* eslint-env jest */

describe('Accessibility: aria-valid-attr audit', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
'use strict';

import Audit from '../../../audits/accessibility/aria-valid-attr-value.js';

import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/aria-valid-attr-value.js';

/* eslint-env jest */

describe('Accessibility: aria-valid-attr-value audit', () => {
Expand Down
6 changes: 4 additions & 2 deletions lighthouse-core/test/audits/accessibility/axe-audit-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
'use strict';

import AxeAudit from '../../../audits/accessibility/axe-audit.js';

import {strict as assert} from 'assert';

import axeCore from 'axe-core';

import AxeAudit from '../../../audits/accessibility/axe-audit.js';
import Accesskeys from '../../../audits/accessibility/accesskeys.js';
import format from '../../../../shared/localization/format.js';

Expand Down
5 changes: 3 additions & 2 deletions lighthouse-core/test/audits/accessibility/button-name-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
'use strict';

import Audit from '../../../audits/accessibility/button-name.js';

import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/button-name.js';

/* eslint-env jest */

describe('Accessibility: button-name audit', () => {
Expand Down
5 changes: 3 additions & 2 deletions lighthouse-core/test/audits/accessibility/bypass-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
'use strict';

import Audit from '../../../audits/accessibility/bypass.js';

import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/bypass.js';

/* eslint-env jest */

describe('Accessibility: bypass audit', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
'use strict';

import Audit from '../../../audits/accessibility/color-contrast.js';

import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/color-contrast.js';

/* eslint-env jest */

describe('Accessibility: color-contrast audit', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
'use strict';

import Audit from '../../../audits/accessibility/definition-list.js';

import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/definition-list.js';

/* eslint-env jest */

describe('Accessibility: definition-list audit', () => {
Expand Down
5 changes: 3 additions & 2 deletions lighthouse-core/test/audits/accessibility/dlitem-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
'use strict';

import Audit from '../../../audits/accessibility/dlitem.js';

import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/dlitem.js';

/* eslint-env jest */

describe('Accessibility: dlitem audit', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
'use strict';

import Audit from '../../../audits/accessibility/document-title.js';

import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/document-title.js';

/* eslint-env jest */

describe('Accessibility: document-title audit', () => {
Expand Down
5 changes: 3 additions & 2 deletions lighthouse-core/test/audits/accessibility/frame-title-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
'use strict';

import Audit from '../../../audits/accessibility/frame-title.js';

import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/frame-title.js';

/* eslint-env jest */

describe('Accessibility: frame-title audit', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
'use strict';

import Audit from '../../../audits/accessibility/html-has-lang.js';

import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/html-has-lang.js';

/* eslint-env jest */

describe('Accessibility: html-has-lang audit', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
'use strict';

import Audit from '../../../audits/accessibility/html-lang-valid.js';

import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/html-lang-valid.js';

/* eslint-env jest */

describe('Accessibility: html-lang-valid audit', () => {
Expand Down
5 changes: 3 additions & 2 deletions lighthouse-core/test/audits/accessibility/image-alt-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
'use strict';

import Audit from '../../../audits/accessibility/image-alt.js';

import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/image-alt.js';

/* eslint-env jest */

describe('Accessibility: image-alt audit', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
'use strict';

import Audit from '../../../audits/accessibility/input-image-alt.js';

import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/input-image-alt.js';

/* eslint-env jest */

describe('Accessibility: input-image-alt audit', () => {
Expand Down
5 changes: 3 additions & 2 deletions lighthouse-core/test/audits/accessibility/label-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
'use strict';

import Audit from '../../../audits/accessibility/label.js';

import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/label.js';

/* eslint-env jest */

describe('Accessibility: label audit', () => {
Expand Down
5 changes: 3 additions & 2 deletions lighthouse-core/test/audits/accessibility/link-name-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
'use strict';

import Audit from '../../../audits/accessibility/link-name.js';

import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/link-name.js';

/* eslint-env jest */

describe('Accessibility: link-name audit', () => {
Expand Down
5 changes: 3 additions & 2 deletions lighthouse-core/test/audits/accessibility/list-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
'use strict';

import Audit from '../../../audits/accessibility/list.js';

import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/list.js';

/* eslint-env jest */

describe('Accessibility: list audit', () => {
Expand Down
5 changes: 3 additions & 2 deletions lighthouse-core/test/audits/accessibility/listitem-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
'use strict';

import Audit from '../../../audits/accessibility/listitem.js';

import {strict as assert} from 'assert';

import Audit from '../../../audits/accessibility/listitem.js';

/* eslint-env jest */

describe('Accessibility: listitem audit', () => {
Expand Down
Loading