Skip to content

Commit

Permalink
chore: fix EsLint for .mjs (#11629)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lightning00Blade authored Jan 8, 2024
1 parent ff761bc commit 35e39bf
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test/output-*/
coverage/
generated/
.eslintcache
/.cache/
.cache/

# IDE Artifacts
.vscode
Expand Down
13 changes: 7 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports = {

parser: '@typescript-eslint/parser',

plugins: ['mocha', '@typescript-eslint', 'import'],
plugins: ['mocha', '@typescript-eslint', 'import', 'rulesdir'],

extends: ['plugin:prettier/recommended', 'plugin:import/typescript'],

Expand Down Expand Up @@ -144,6 +144,11 @@ module.exports = {
// Don't allow underscored declarations on camelCased variables/properties.
// ...RESTRICTED_UNDERSCORED_IDENTIFIERS,
],

// Keeps comments formatted.
'rulesdir/prettier-comments': 'error',
// Enforces consistent file extension
'rulesdir/extensions': 'error',
},
overrides: [
{
Expand All @@ -157,14 +162,10 @@ module.exports = {
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/stylistic',
],
plugins: ['eslint-plugin-tsdoc', 'rulesdir'],
plugins: ['eslint-plugin-tsdoc'],
rules: {
// Keeps comments formatted.
'rulesdir/prettier-comments': 'error',
// Enforces clean up of used resources.
'rulesdir/use-using': 'error',
// Enforces consistent file extension
'rulesdir/extensions': 'error',
// Brackets keep code readable.
curly: ['error', 'all'],
// Brackets keep code readable and `return` intentions clear.
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test/output-*/
coverage/
generated/
.eslintcache
/.cache/
.cache/

# IDE Artifacts
.vscode/*
Expand Down
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test/output-*/
coverage/
generated/
.eslintcache
/.cache/
.cache/

# IDE Artifacts
.vscode/*
Expand Down
3 changes: 1 addition & 2 deletions Herebyfile.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import {copyFile, readFile, writeFile} from 'fs/promises';

import {docgen, spliceIntoSection} from '@puppeteer/docgen';
import {execa} from 'execa';
import {task} from 'hereby';
import semver from 'semver';

import {docgen, spliceIntoSection} from '@puppeteer/docgen';

export const docsNgSchematicsTask = task({
name: 'docs:ng-schematics',
run: async () => {
Expand Down
6 changes: 2 additions & 4 deletions examples/cross-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ const puppeteer = require('puppeteer');
/**
* To have Puppeteer fetch a Firefox binary for you, first run:
*
* PUPPETEER_PRODUCT=firefox npm install
* PUPPETEER_PRODUCT=firefox npm install
*
* To get additional logging about which browser binary is executed,
* run this example as:
*
* DEBUG=puppeteer:launcher NODE_PATH=../ node examples/cross-browser.js
* DEBUG=puppeteer:launcher NODE_PATH=../ node examples/cross-browser.js
*
* You can set a custom binary with the `executablePath` launcher option.
*
*
*/

const firefoxOptions = {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
"docs": "wireit",
"doctest": "wireit",
"format": "run-s format:*",
"format:eslint": "eslint --ext js --ext ts --fix .",
"format:eslint": "eslint --ext js --ext mjs --ext ts --fix .",
"format:expectations": "node tools/sort-test-expectations.mjs",
"format:prettier": "prettier --write .",
"lint": "run-s lint:*",
"lint:eslint": "([ \"$CI\" = true ] && eslint --ext js --ext ts --quiet . || eslint --ext js --ext ts .)",
"lint:eslint": "eslint --ext js --ext mjs --ext ts .",
"lint:prettier": "prettier --check .",
"lint:expectations": "node tools/sort-test-expectations.mjs --lint",
"postinstall": "npm run postinstall --workspaces --if-present",
Expand Down
1 change: 0 additions & 1 deletion packages/browsers/.gitignore

This file was deleted.

4 changes: 2 additions & 2 deletions packages/browsers/test/src/chrome/launch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ describe('Chrome', () => {
browser: Browser.CHROME,
platform: BrowserPlatform.LINUX,
buildId: '123',
cacheDir: 'cache',
cacheDir: '.cache',
}),
path.join('cache', 'chrome', 'linux-123', 'chrome-linux64', 'chrome')
path.join('.cache', 'chrome', 'linux-123', 'chrome-linux64', 'chrome')
);
});

Expand Down
4 changes: 2 additions & 2 deletions packages/browsers/test/src/chromium/launch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ describe('Chromium', () => {
browser: Browser.CHROMIUM,
platform: BrowserPlatform.LINUX,
buildId: '123',
cacheDir: 'cache',
cacheDir: '.cache',
}),
path.join('cache', 'chromium', 'linux-123', 'chrome-linux', 'chrome')
path.join('.cache', 'chromium', 'linux-123', 'chrome-linux', 'chrome')
);
});

Expand Down
4 changes: 2 additions & 2 deletions packages/browsers/test/src/firefox/launch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ describe('Firefox', () => {
browser: Browser.FIREFOX,
platform: BrowserPlatform.LINUX,
buildId: '123',
cacheDir: 'cache',
cacheDir: '.cache',
}),
path.join('cache', 'firefox', 'linux-123', 'firefox', 'firefox')
path.join('.cache', 'firefox', 'linux-123', 'firefox', 'firefox')
);
});

Expand Down
2 changes: 1 addition & 1 deletion packages/browsers/test/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function createMockedReadlineInterface(
}

const startServer = async () => {
const assetsPath = path.join(__dirname, '..', 'cache', 'server');
const assetsPath = path.join(__dirname, '..', '.cache', 'server');
return await TestServer.create(assetsPath);
};

Expand Down
4 changes: 2 additions & 2 deletions packages/browsers/tools/downloadTestBrowsers.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

/**
* Downloads test browser binaries to test/cache/server folder that
* Downloads test browser binaries to test/.cache/server folder that
* mirrors the structure of the download server.
*/

Expand All @@ -32,7 +32,7 @@ function getBrowser(str) {
}
}

const cacheDir = normalize(join('.', 'test', 'cache'));
const cacheDir = normalize(join('.', 'test', '.cache'));

for (const version of Object.keys(versions)) {
const browser = getBrowser(version);
Expand Down
5 changes: 3 additions & 2 deletions tools/download_chrome_bidi.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
* param for GitHub actions.
*
* Examples:
* - `node install-browser.mjs`
* - `node install-browser.mjs /tmp/cache`
*
* - `node install-browser.mjs`
* - `node install-browser.mjs /tmp/cache`
*/
import {readFile} from 'node:fs/promises';
import {createRequire} from 'node:module';
Expand Down
1 change: 1 addition & 0 deletions website/archive.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* "Archives" older versions of the website docs to reduce the build time:
*
* - keeps one latest version + next
* - moves older versions to versionsArchived.json
*/
Expand Down

0 comments on commit 35e39bf

Please sign in to comment.