Skip to content

Commit

Permalink
build: fix EsLint rule and add fixer (#11826)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lightning00Blade committed Feb 5, 2024
1 parent 197f005 commit b2c69fe
Show file tree
Hide file tree
Showing 38 changed files with 230 additions and 34 deletions.
11 changes: 9 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,6 @@ module.exports = {
curly: ['error', 'all'],
// Brackets keep code readable and `return` intentions clear.
'arrow-body-style': ['error', 'always'],
// Error if comments do not adhere to `tsdoc`.
'tsdoc/syntax': 'error',
// Keeps array types simple only when they are simple for readability.
'@typescript-eslint/array-type': ['error', {default: 'array-simple'}],
'no-unused-vars': 'off',
Expand Down Expand Up @@ -277,5 +275,14 @@ module.exports = {
},
],
},

{
// Applies to only published packages
files: ['packages/**/*.ts'],
rules: {
// Error if comments do not adhere to `tsdoc`.
'tsdoc/syntax': 'error',
},
},
],
};
5 changes: 5 additions & 0 deletions docker/test/smoke-test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
const puppeteer = require('puppeteer');

(async () => {
Expand Down
5 changes: 5 additions & 0 deletions examples/cross-browser.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
const puppeteer = require('puppeteer');

/**
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions packages/browsers/test/src/mocha-utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import debug from 'debug';

export const mochaHooks = {
Expand Down
5 changes: 5 additions & 0 deletions packages/ng-schematics/src/builders/puppeteer/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import {spawn} from 'child_process';
import {normalize, join} from 'path';

Expand Down
5 changes: 5 additions & 0 deletions packages/ng-schematics/test/src/config.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import {describe, it} from 'node:test';

import expect from 'expect';
Expand Down
5 changes: 5 additions & 0 deletions packages/ng-schematics/test/src/e2e.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import {describe, it} from 'node:test';

import expect from 'expect';
Expand Down
5 changes: 5 additions & 0 deletions packages/ng-schematics/test/src/ng-add.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import {describe, it} from 'node:test';

import expect from 'expect';
Expand Down
5 changes: 5 additions & 0 deletions packages/ng-schematics/test/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import https from 'https';
import {before, after} from 'node:test';
import {join} from 'path';
Expand Down
15 changes: 15 additions & 0 deletions packages/ng-schematics/test/tsdoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",

"extends": ["@microsoft/api-extractor/extends/tsdoc-base.json"],
"tagDefinitions": [
{
"tagName": "@license",
"syntaxKind": "modifier",
"allowMultiple": false
}
],
"supportForTags": {
"@license": true
}
}
5 changes: 5 additions & 0 deletions packages/puppeteer-core/Herebyfile.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import {mkdir, readFile, readdir, writeFile} from 'fs/promises';
import {join} from 'path/posix';

Expand Down
5 changes: 5 additions & 0 deletions packages/puppeteer-core/src/api/CDPSession.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import type {ProtocolMapping} from 'devtools-protocol/types/protocol-mapping.js';

import type {Connection} from '../cdp/Connection.js';
Expand Down
5 changes: 5 additions & 0 deletions packages/puppeteer-core/src/bidi/BrowsingContext.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import type * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
import type ProtocolMapping from 'devtools-protocol/types/protocol-mapping.js';

Expand Down
5 changes: 5 additions & 0 deletions packages/puppeteer-core/src/bidi/Realm.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';

import {EventEmitter, type EventType} from '../common/EventEmitter.js';
Expand Down
5 changes: 5 additions & 0 deletions packages/puppeteer-core/src/cdp/Binding.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import {JSHandle} from '../api/JSHandle.js';
import {debugError} from '../common/util.js';
import {DisposableStack} from '../util/disposable.js';
Expand Down
5 changes: 5 additions & 0 deletions packages/puppeteer-core/src/common/ScriptInjector.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import {source as injectedSource} from '../generated/injected.js';

/**
Expand Down
5 changes: 5 additions & 0 deletions packages/puppeteer-core/src/injected/util.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
const HIDDEN_VISIBILITY_VALUES = ['hidden', 'collapse'];

/**
Expand Down
5 changes: 5 additions & 0 deletions packages/puppeteer-core/src/util/Deferred.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import {TimeoutError} from '../common/Errors.js';

/**
Expand Down
5 changes: 5 additions & 0 deletions packages/puppeteer-core/src/util/Mutex.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import {Deferred} from './Deferred.js';
import {disposeSymbol} from './disposable.js';

Expand Down
5 changes: 5 additions & 0 deletions test-d/CommonEventEmitter.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
// eslint-disable-next-line no-restricted-imports
import {EventEmitter as NodeEventEmitter} from 'node:events';

Expand Down
5 changes: 5 additions & 0 deletions test-d/ElementHandle.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import {expectNotType, expectType} from 'tsd';

import type {ElementHandle} from 'puppeteer';
Expand Down
5 changes: 5 additions & 0 deletions test-d/JSHandle.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import {expectNotAssignable, expectNotType, expectType} from 'tsd';

import type {ElementHandle, JSHandle} from 'puppeteer';
Expand Down
5 changes: 5 additions & 0 deletions test-d/NodeFor.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import {expectType, expectNotType} from 'tsd';

import type {NodeFor} from 'puppeteer';
Expand Down
5 changes: 5 additions & 0 deletions test-d/puppeteer.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import {expectType} from 'tsd';

import puppeteer, {
Expand Down
5 changes: 5 additions & 0 deletions test/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
module.exports = {
rules: {
'no-restricted-imports': [
Expand Down
5 changes: 5 additions & 0 deletions test/fixtures/closeme.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
(async () => {
const [, , puppeteerRoot, options] = process.argv;
const browser = await require(puppeteerRoot).launch(JSON.parse(options));
Expand Down
5 changes: 5 additions & 0 deletions test/fixtures/dumpio.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
(async () => {
const [, , puppeteerRoot, options] = process.argv;
const browser = await require(puppeteerRoot).launch(JSON.parse(options));
Expand Down
6 changes: 6 additions & 0 deletions tools/analyze_issue.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/usr/bin/env node
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/

// @ts-check

'use strict';
Expand Down
Loading

0 comments on commit b2c69fe

Please sign in to comment.