diff --git a/.eslintignore b/.eslintignore index f7365e0082..152cbbe228 100644 --- a/.eslintignore +++ b/.eslintignore @@ -19,4 +19,5 @@ tests/components/ tests/installation/fixture-scripts/ examples/ DEPS -.cache/ \ No newline at end of file +.cache/ +utils/ diff --git a/.eslintrc.js b/.eslintrc.js index 7bc5a0868f..ab0ffeecee 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -4,6 +4,7 @@ module.exports = { parserOptions: { ecmaVersion: 9, sourceType: "module", + project: "./tsconfig.json", }, extends: [ "plugin:react-hooks/recommended" diff --git a/package.json b/package.json index 89550ec4e4..e62801990d 100644 --- a/package.json +++ b/package.json @@ -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", "ct": "playwright test tests/components/test-all.spec.js --reporter=list", "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 .", "build-installer": "babel -s --extensions \".ts\" --out-dir packages/playwright-core/lib/utils/ packages/playwright-core/src/utils", "doc": "node utils/doclint/cli.js", diff --git a/packages/playwright-ct-react/registerSource.mjs b/packages/playwright-ct-react/registerSource.mjs index 10dad4c0db..9ad2612bc4 100644 --- a/packages/playwright-ct-react/registerSource.mjs +++ b/packages/playwright-ct-react/registerSource.mjs @@ -40,13 +40,11 @@ function __pwRender(value) { if (isJsxComponent(v)) { const component = v; const props = component.props ? __pwRender(component.props) : {}; - const {children, ...propsWithoutChildren} = props; - /** @type {[any, any, any?]} */ - const createElementArguments = [component.type, propsWithoutChildren]; - if(children){ + const { children, ...propsWithoutChildren } = props; + const createElementArguments = [propsWithoutChildren]; + if (children) createElementArguments.push(children); - } - return { result: __pwReact.createElement(...createElementArguments) }; + return { result: __pwReact.createElement(component.type, ...createElementArguments) }; } }); } diff --git a/packages/playwright-ct-react17/registerSource.mjs b/packages/playwright-ct-react17/registerSource.mjs index 8dfc1d24e9..158984f3ac 100644 --- a/packages/playwright-ct-react17/registerSource.mjs +++ b/packages/playwright-ct-react17/registerSource.mjs @@ -40,14 +40,11 @@ function __pwRender(value) { if (isJsxComponent(v)) { const component = v; const props = component.props ? __pwRender(component.props) : {}; - - const {children, ...propsWithoutChildren} = props; - /** @type {[any, any, any?]} */ - const createElementArguments = [component.type, propsWithoutChildren]; - if(children){ + const { children, ...propsWithoutChildren } = props; + const createElementArguments = [propsWithoutChildren]; + if (children) createElementArguments.push(children); - } - return { result: __pwReact.createElement(...createElementArguments) }; + return { result: __pwReact.createElement(component.type, ...createElementArguments) }; } }); } diff --git a/packages/playwright-ct-svelte/registerSource.mjs b/packages/playwright-ct-svelte/registerSource.mjs index 4552a4ba0a..b11f8e0369 100644 --- a/packages/playwright-ct-svelte/registerSource.mjs +++ b/packages/playwright-ct-svelte/registerSource.mjs @@ -42,8 +42,8 @@ function __pwCreateSlots(slots) { for (const slotName in slots) { const template = document - .createRange() - .createContextualFragment(slots[slotName]); + .createRange() + .createContextualFragment(slots[slotName]); svelteSlots[slotName] = [createSlotFn(template)]; } diff --git a/packages/playwright/.eslintrc.js b/packages/playwright/.eslintrc.js index 67c9b6313d..71985134bd 100644 --- a/packages/playwright/.eslintrc.js +++ b/packages/playwright/.eslintrc.js @@ -1,14 +1,5 @@ -const path = require('path'); - module.exports = { extends: '../.eslintrc.js', - parser: "@typescript-eslint/parser", - plugins: ["@typescript-eslint", "notice"], - parserOptions: { - ecmaVersion: 9, - sourceType: "module", - project: path.join(__dirname, '..', '..', 'tsconfig.json'), - }, rules: { '@typescript-eslint/no-floating-promises': 'error', }, diff --git a/tsconfig.json b/tsconfig.json index 733973760a..56d9996996 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -35,11 +35,5 @@ "include": ["packages"], "exclude": [ "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" ], }