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/ coverage/
generated/ generated/
.eslintcache .eslintcache
/.cache/ .cache/
# IDE Artifacts # IDE Artifacts
.vscode .vscode

View File

@ -35,7 +35,7 @@ module.exports = {
parser: '@typescript-eslint/parser', parser: '@typescript-eslint/parser',
plugins: ['mocha', '@typescript-eslint', 'import'], plugins: ['mocha', '@typescript-eslint', 'import', 'rulesdir'],
extends: ['plugin:prettier/recommended', 'plugin:import/typescript'], extends: ['plugin:prettier/recommended', 'plugin:import/typescript'],
@ -144,6 +144,11 @@ module.exports = {
// Don't allow underscored declarations on camelCased variables/properties. // Don't allow underscored declarations on camelCased variables/properties.
// ...RESTRICTED_UNDERSCORED_IDENTIFIERS, // ...RESTRICTED_UNDERSCORED_IDENTIFIERS,
], ],
// Keeps comments formatted.
'rulesdir/prettier-comments': 'error',
// Enforces consistent file extension
'rulesdir/extensions': 'error',
}, },
overrides: [ overrides: [
{ {
@ -157,14 +162,10 @@ module.exports = {
'plugin:@typescript-eslint/recommended', 'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/stylistic', 'plugin:@typescript-eslint/stylistic',
], ],
plugins: ['eslint-plugin-tsdoc', 'rulesdir'], plugins: ['eslint-plugin-tsdoc'],
rules: { rules: {
// Keeps comments formatted.
'rulesdir/prettier-comments': 'error',
// Enforces clean up of used resources. // Enforces clean up of used resources.
'rulesdir/use-using': 'error', 'rulesdir/use-using': 'error',
// Enforces consistent file extension
'rulesdir/extensions': 'error',
// Brackets keep code readable. // Brackets keep code readable.
curly: ['error', 'all'], curly: ['error', 'all'],
// Brackets keep code readable and `return` intentions clear. // Brackets keep code readable and `return` intentions clear.

2
.gitignore vendored
View File

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

View File

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

View File

@ -1,11 +1,10 @@
import {copyFile, readFile, writeFile} from 'fs/promises'; import {copyFile, readFile, writeFile} from 'fs/promises';
import {docgen, spliceIntoSection} from '@puppeteer/docgen';
import {execa} from 'execa'; import {execa} from 'execa';
import {task} from 'hereby'; import {task} from 'hereby';
import semver from 'semver'; import semver from 'semver';
import {docgen, spliceIntoSection} from '@puppeteer/docgen';
export const docsNgSchematicsTask = task({ export const docsNgSchematicsTask = task({
name: 'docs:ng-schematics', name: 'docs:ng-schematics',
run: async () => { run: async () => {

View File

@ -11,8 +11,6 @@ const puppeteer = require('puppeteer');
* 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. * You can set a custom binary with the `executablePath` launcher option.
*
*
*/ */
const firefoxOptions = { const firefoxOptions = {

View File

@ -15,11 +15,11 @@
"docs": "wireit", "docs": "wireit",
"doctest": "wireit", "doctest": "wireit",
"format": "run-s format:*", "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:expectations": "node tools/sort-test-expectations.mjs",
"format:prettier": "prettier --write .", "format:prettier": "prettier --write .",
"lint": "run-s lint:*", "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:prettier": "prettier --check .",
"lint:expectations": "node tools/sort-test-expectations.mjs --lint", "lint:expectations": "node tools/sort-test-expectations.mjs --lint",
"postinstall": "npm run postinstall --workspaces --if-present", "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, browser: Browser.CHROME,
platform: BrowserPlatform.LINUX, platform: BrowserPlatform.LINUX,
buildId: '123', 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, browser: Browser.CHROMIUM,
platform: BrowserPlatform.LINUX, platform: BrowserPlatform.LINUX,
buildId: '123', 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, browser: Browser.FIREFOX,
platform: BrowserPlatform.LINUX, platform: BrowserPlatform.LINUX,
buildId: '123', 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 startServer = async () => {
const assetsPath = path.join(__dirname, '..', 'cache', 'server'); const assetsPath = path.join(__dirname, '..', '.cache', 'server');
return await TestServer.create(assetsPath); 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. * 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)) { for (const version of Object.keys(versions)) {
const browser = getBrowser(version); const browser = getBrowser(version);

View File

@ -13,6 +13,7 @@
* param for GitHub actions. * param for GitHub actions.
* *
* Examples: * Examples:
*
* - `node install-browser.mjs` * - `node install-browser.mjs`
* - `node install-browser.mjs /tmp/cache` * - `node install-browser.mjs /tmp/cache`
*/ */

View File

@ -1,5 +1,6 @@
/** /**
* "Archives" older versions of the website docs to reduce the build time: * "Archives" older versions of the website docs to reduce the build time:
*
* - keeps one latest version + next * - keeps one latest version + next
* - moves older versions to versionsArchived.json * - moves older versions to versionsArchived.json
*/ */