chore: enable eslint for js (#29639)

This commit is contained in:
Pavel Feldman 2024-02-26 09:39:21 -08:00 committed by GitHub
parent c5af51c59d
commit 7eb910a652
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 14 additions and 32 deletions

View File

@ -19,4 +19,5 @@ tests/components/
tests/installation/fixture-scripts/ tests/installation/fixture-scripts/
examples/ examples/
DEPS DEPS
.cache/ .cache/
utils/

View File

@ -4,6 +4,7 @@ module.exports = {
parserOptions: { parserOptions: {
ecmaVersion: 9, ecmaVersion: 9,
sourceType: "module", sourceType: "module",
project: "./tsconfig.json",
}, },
extends: [ extends: [
"plugin:react-hooks/recommended" "plugin:react-hooks/recommended"

View File

@ -29,7 +29,7 @@
"ttest": "node ./tests/playwright-test/stable-test-runner/node_modules/@playwright/test/cli test --config=tests/playwright-test/playwright.config.ts", "ttest": "node ./tests/playwright-test/stable-test-runner/node_modules/@playwright/test/cli test --config=tests/playwright-test/playwright.config.ts",
"ct": "playwright test tests/components/test-all.spec.js --reporter=list", "ct": "playwright test tests/components/test-all.spec.js --reporter=list",
"test": "playwright test --config=tests/library/playwright.config.ts", "test": "playwright test --config=tests/library/playwright.config.ts",
"eslint": "eslint --cache --report-unused-disable-directives --ext ts,tsx .", "eslint": "eslint --cache --report-unused-disable-directives --ext ts,tsx,js,jsx,mjs .",
"tsc": "tsc -p .", "tsc": "tsc -p .",
"build-installer": "babel -s --extensions \".ts\" --out-dir packages/playwright-core/lib/utils/ packages/playwright-core/src/utils", "build-installer": "babel -s --extensions \".ts\" --out-dir packages/playwright-core/lib/utils/ packages/playwright-core/src/utils",
"doc": "node utils/doclint/cli.js", "doc": "node utils/doclint/cli.js",

View File

@ -40,13 +40,11 @@ function __pwRender(value) {
if (isJsxComponent(v)) { if (isJsxComponent(v)) {
const component = v; const component = v;
const props = component.props ? __pwRender(component.props) : {}; const props = component.props ? __pwRender(component.props) : {};
const {children, ...propsWithoutChildren} = props; const { children, ...propsWithoutChildren } = props;
/** @type {[any, any, any?]} */ const createElementArguments = [propsWithoutChildren];
const createElementArguments = [component.type, propsWithoutChildren]; if (children)
if(children){
createElementArguments.push(children); createElementArguments.push(children);
} return { result: __pwReact.createElement(component.type, ...createElementArguments) };
return { result: __pwReact.createElement(...createElementArguments) };
} }
}); });
} }

View File

@ -40,14 +40,11 @@ function __pwRender(value) {
if (isJsxComponent(v)) { if (isJsxComponent(v)) {
const component = v; const component = v;
const props = component.props ? __pwRender(component.props) : {}; const props = component.props ? __pwRender(component.props) : {};
const { children, ...propsWithoutChildren } = props;
const {children, ...propsWithoutChildren} = props; const createElementArguments = [propsWithoutChildren];
/** @type {[any, any, any?]} */ if (children)
const createElementArguments = [component.type, propsWithoutChildren];
if(children){
createElementArguments.push(children); createElementArguments.push(children);
} return { result: __pwReact.createElement(component.type, ...createElementArguments) };
return { result: __pwReact.createElement(...createElementArguments) };
} }
}); });
} }

View File

@ -42,8 +42,8 @@ function __pwCreateSlots(slots) {
for (const slotName in slots) { for (const slotName in slots) {
const template = document const template = document
.createRange() .createRange()
.createContextualFragment(slots[slotName]); .createContextualFragment(slots[slotName]);
svelteSlots[slotName] = [createSlotFn(template)]; svelteSlots[slotName] = [createSlotFn(template)];
} }

View File

@ -1,14 +1,5 @@
const path = require('path');
module.exports = { module.exports = {
extends: '../.eslintrc.js', extends: '../.eslintrc.js',
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "notice"],
parserOptions: {
ecmaVersion: 9,
sourceType: "module",
project: path.join(__dirname, '..', '..', 'tsconfig.json'),
},
rules: { rules: {
'@typescript-eslint/no-floating-promises': 'error', '@typescript-eslint/no-floating-promises': 'error',
}, },

View File

@ -35,11 +35,5 @@
"include": ["packages"], "include": ["packages"],
"exclude": [ "exclude": [
"packages/*/lib", "packages/*/lib",
"packages/playwright-ct-react",
"packages/playwright-ct-react17",
"packages/playwright-ct-solid",
"packages/playwright-ct-svelte",
"packages/playwright-ct-vue",
"packages/playwright-ct-vue2"
], ],
} }