Skip to content

Commit

Permalink
misc: move ES modules lint rules to root (#14349)
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark authored Sep 2, 2022
1 parent 164ad23 commit fd304ed
Show file tree
Hide file tree
Showing 404 changed files with 162 additions and 715 deletions.
21 changes: 20 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
*/
'use strict';

/**
* eslint does not support ESM rc files, so this must be a .cjs file.
* @see https://eslint.org/docs/user-guide/configuring/configuration-files#configuration-file-formats
* @see https://github.com/eslint/eslint/issues/13481
*/

module.exports = {
// All subdirectory eslintrcs extend from this one.
root: true,
Expand All @@ -21,6 +27,19 @@ module.exports = {
},
rules: {
// 2 == error, 1 == warning, 0 == off
'import/order': [2, {
'groups': [
'builtin',
'external',
['sibling', 'parent'],
'index',
'object',
'type',
],
'newlines-between': 'always',
}],
'import/group-exports': 2,
'import/exports-last': 2,
'eqeqeq': 2,
'indent': [2, 2, {
SwitchCase: 1,
Expand Down Expand Up @@ -95,6 +114,6 @@ module.exports = {
globalReturn: true,
jsx: false,
},
sourceType: 'script',
sourceType: 'module',
},
};
1 change: 0 additions & 1 deletion build-tracker.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// https://buildtracker.dev/docs/installation/#upload-your-builds

'use strict';

module.exports = {
applicationUrl: 'https://lh-build-tracker.herokuapp.com',
Expand Down
28 changes: 0 additions & 28 deletions build/.eslintrc.cjs

This file was deleted.

1 change: 0 additions & 1 deletion build/plugins/browserify-inline-fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* 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.
*/


/** @fileoverview An inline-fs plugin for browserify. */

import {Transform} from 'stream';
Expand Down
28 changes: 0 additions & 28 deletions cli/.eslintrc.cjs

This file was deleted.

4 changes: 2 additions & 2 deletions clients/devtools/devtools-entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
* 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';

/* global globalThis */

import {Buffer} from 'buffer';

import log from 'lighthouse-logger';

import lighthouse, {legacyNavigation} from '../../core/index.js';
import {navigation, startTimespan, snapshot} from '../../core/fraggle-rock/api.js';
import {RawConnection} from '../../core/gather/connections/raw.js';
import log from 'lighthouse-logger';
import {lookupLocale} from '../../core/lib/i18n/i18n.js';
import {registerLocaleData, getCanonicalLocales} from '../../shared/localization/format.js';
import * as constants from '../../core/config/constants.js';
Expand Down
1 change: 0 additions & 1 deletion clients/extension/scripts/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* 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 * as SettingsController from './settings-controller.js';

Expand Down
1 change: 0 additions & 1 deletion clients/extension/scripts/settings-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* 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';

// Manually define the default categories, instead of bundling a lot of i18n code.
const DEFAULT_CATEGORIES = [{
Expand Down
10 changes: 6 additions & 4 deletions clients/lightrider/lightrider-entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,19 @@
* 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';

/* global globalThis */

import {Buffer} from 'buffer';
import log from 'lighthouse-logger';

import log from 'lighthouse-logger';
import {Browser} from 'puppeteer-core/lib/esm/puppeteer/common/Browser.js';
import {Connection as PptrConnection} from 'puppeteer-core/lib/esm/puppeteer/common/Connection.js';

import lighthouse, {legacyNavigation} from '../../core/index.js';
import {LighthouseError} from '../../core/lib/lh-error.js';
import {processForProto} from '../../core/lib/proto-preprocessor.js';
import * as assetSaver from '../../core/lib/asset-saver.js';

import mobileConfig from '../../core/config/lr-mobile-config.js';
import desktopConfig from '../../core/config/lr-desktop-config.js';

Expand Down Expand Up @@ -79,7 +77,7 @@ async function getPageFromConnection(connection) {
* @param {{lrDevice?: 'desktop'|'mobile', categoryIDs?: Array<string>, logAssets: boolean, configOverride?: LH.Config.Json, useFraggleRock?: boolean}} lrOpts Options coming from Lightrider
* @return {Promise<string>}
*/
export async function runLighthouseInLR(connection, url, flags, lrOpts) {
async function runLighthouseInLR(connection, url, flags, lrOpts) {
const {lrDevice, categoryIDs, logAssets, configOverride} = lrOpts;

// Certain fixes need to kick in under LR, see https://github.com/GoogleChrome/lighthouse/issues/5839
Expand Down Expand Up @@ -162,3 +160,7 @@ if (typeof window !== 'undefined') {
// @ts-expect-error
self.listenForStatus = listenForStatus;
}

export {
runLighthouseInLR,
};
3 changes: 2 additions & 1 deletion clients/test/extension/popup-test-pptr.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 path from 'path';

import puppeteer from 'puppeteer-core';
import {getChromePath} from 'chrome-launcher';

import {DEFAULT_CATEGORIES, STORAGE_KEYS} from '../../extension/scripts/settings-controller.js';
import {LH_ROOT} from '../../../root.js';

Expand Down
1 change: 0 additions & 1 deletion clients/test/extension/settings-controller-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* 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 * as SettingsController from '../../extension/scripts/settings-controller.js';
import defaultConfig from '../../../core/config/default-config.js';
Expand Down
5 changes: 3 additions & 2 deletions clients/test/lightrider/lightrider-entry-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
* 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 jestMock from 'jest-mock';
import {strict as assert} from 'assert';

import jestMock from 'jest-mock';

import {runLighthouseInLR} from '../../lightrider/lightrider-entry.js';
import {Runner} from '../../../core/runner.js';
import {LighthouseError} from '../../../core/lib/lh-error.js';
Expand Down
1 change: 0 additions & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* 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';

module.exports = {
extends: ['cz'],
Expand Down
2 changes: 0 additions & 2 deletions core/audits/accessibility/accesskeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +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';

/**
* @fileoverview Ensures accesskey values are unique.
* See base class in axe-audit.js for audit() implementation.
*/

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

import * as i18n from '../../lib/i18n/i18n.js';

const UIStrings = {
Expand Down
2 changes: 0 additions & 2 deletions core/audits/accessibility/aria-allowed-attr.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +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';

/**
* @fileoverview Ensures ARIA attributes are allowed for an element's role.
* See base class in axe-audit.js for audit() implementation.
*/

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

import * as i18n from '../../lib/i18n/i18n.js';

const UIStrings = {
Expand Down
2 changes: 0 additions & 2 deletions core/audits/accessibility/aria-command-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +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';

/**
* @fileoverview Ensures every ARIA button, link and menuitem element has an accessible name
* See base class in axe-audit.js for audit() implementation.
*/

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

import * as i18n from '../../lib/i18n/i18n.js';

const UIStrings = {
Expand Down
2 changes: 0 additions & 2 deletions core/audits/accessibility/aria-hidden-body.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +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';

/**
* @fileoverview Ensures `aria-hidden='true'` is not present on the document body.
* See base class in axe-audit.js for audit() implementation.
*/

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

import * as i18n from '../../lib/i18n/i18n.js';

const UIStrings = {
Expand Down
2 changes: 0 additions & 2 deletions core/audits/accessibility/aria-hidden-focus.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +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';

/**
* @fileoverview Ensures `aria-hidden` elements do not contain focusable elements.
* See base class in axe-audit.js for audit() implementation.
*/

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

import * as i18n from '../../lib/i18n/i18n.js';

const UIStrings = {
Expand Down
2 changes: 0 additions & 2 deletions core/audits/accessibility/aria-input-field-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +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';

/**
* @fileoverview Ensures all ARIA input fields have an accessible name.
* See base class in axe-audit.js for audit() implementation.
*/

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

import * as i18n from '../../lib/i18n/i18n.js';

const UIStrings = {
Expand Down
2 changes: 0 additions & 2 deletions core/audits/accessibility/aria-meter-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +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';

/**
* @fileoverview Ensures every ARIA meter element has an accessible name
* See base class in axe-audit.js for audit() implementation.
*/

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

import * as i18n from '../../lib/i18n/i18n.js';

const UIStrings = {
Expand Down
2 changes: 0 additions & 2 deletions core/audits/accessibility/aria-progressbar-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +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';

/**
* @fileoverview Ensures every ARIA progressbar element has an accessible name
* See base class in axe-audit.js for audit() implementation.
*/

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

import * as i18n from '../../lib/i18n/i18n.js';

const UIStrings = {
Expand Down
2 changes: 0 additions & 2 deletions core/audits/accessibility/aria-required-attr.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +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';

/**
* @fileoverview Ensures elements with ARIA roles have all required ARIA attributes.
* See base class in axe-audit.js for audit() implementation.
*/

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

import * as i18n from '../../lib/i18n/i18n.js';

const UIStrings = {
Expand Down
2 changes: 0 additions & 2 deletions core/audits/accessibility/aria-required-children.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* 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';

/**
* @fileoverview Ensures elements with an ARIA role contain any required children.
Expand All @@ -12,7 +11,6 @@
*/

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

import * as i18n from '../../lib/i18n/i18n.js';

const UIStrings = {
Expand Down
Loading

0 comments on commit fd304ed

Please sign in to comment.