chore: fix EsLint for .mjs (#11629)

This commit is contained in:
Nikolay Vitkov 2024-01-08 10:02:56 +01:00 committed by GitHub
parent ff761bc212
commit 35e39bfae9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 28 additions and 29 deletions

View File

@ -19,7 +19,7 @@ test/output-*/
coverage/
generated/
.eslintcache
/.cache/
.cache/
# IDE Artifacts
.vscode

View File

@ -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'],
@ -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: [
{
@ -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.

2
.gitignore vendored
View File

@ -18,7 +18,7 @@ test/output-*/
coverage/
generated/
.eslintcache
/.cache/
.cache/
# IDE Artifacts
.vscode/*

View File

@ -19,7 +19,7 @@ test/output-*/
coverage/
generated/
.eslintcache
/.cache/
.cache/
# IDE Artifacts
.vscode/*

View File

@ -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 () => {

View File

@ -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 = {

View File

@ -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",

View File

@ -1 +0,0 @@
test/cache

View File

@ -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')
);
});

View File

@ -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')
);
});

View File

@ -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')
);
});

View File

@ -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);
};

View File

@ -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.
*/
@ -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);

View File

@ -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';

View File

@ -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
*/