diff --git a/.eslintIgnore b/.eslintignore similarity index 74% rename from .eslintIgnore rename to .eslintignore index 04dd2c7..d3d90c1 100644 --- a/.eslintIgnore +++ b/.eslintignore @@ -3,4 +3,7 @@ node_moduals .nyc_output coverage +dist +.parcel-cache + tests/browser diff --git a/.eslintrc.json b/.eslintrc.json index 6b403d3..4d260a5 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -20,7 +20,8 @@ }, "import/resolver": { "typescript": { - "alwaysTryTypes": true + "alwaysTryTypes": true, + "project": ["tsconfig.json", "tests/browser/tsconfig.json"] }, "node": { "extensions": [ @@ -99,7 +100,16 @@ }, "rules": { "require-jsdoc": "off", - "jsdoc/require-jsdoc": "off" + "jsdoc/require-jsdoc": "off", + "unicorn/prevent-abbreviations": [ + "error", + { + "allowList": { + "e2e": true + } + } + ], + "unicorn/no-empty-file": "off" } } ], diff --git a/package-lock.json b/package-lock.json index b1b2f11..c593a78 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "@aws-crypto/sha256-js": "^5.2.0", "@wmde/wikibase-datamodel-types": "git+https://github.com/wvanderp/WikibaseDataModelTypes.git", - "axios": "1.6.2", + "axios": "1.6.3", "diff-arrays-of-objects": "git+https://github.com/wvanderp/diff-arrays-of-objects.git", "qs": "^6.11.2", "uuid": "^9.0.1", @@ -3861,9 +3861,9 @@ } }, "node_modules/axios": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", - "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.3.tgz", + "integrity": "sha512-fWyNdeawGam70jXSVlKl+SUNVcL6j6W79CuSIPfi6HnDUmSCH6gyUys/HrqHeA/wU0Az41rRgean494d0Jb+ww==", "dependencies": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", @@ -14732,9 +14732,9 @@ "dev": true }, "axios": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", - "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.3.tgz", + "integrity": "sha512-fWyNdeawGam70jXSVlKl+SUNVcL6j6W79CuSIPfi6HnDUmSCH6gyUys/HrqHeA/wU0Az41rRgean494d0Jb+ww==", "requires": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", diff --git a/package.json b/package.json index 646b23d..a99e75a 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "dependencies": { "@aws-crypto/sha256-js": "^5.2.0", "@wmde/wikibase-datamodel-types": "git+https://github.com/wvanderp/WikibaseDataModelTypes.git", - "axios": "1.6.2", + "axios": "1.6.3", "diff-arrays-of-objects": "git+https://github.com/wvanderp/diff-arrays-of-objects.git", "qs": "^6.11.2", "uuid": "^9.0.1", @@ -69,9 +69,10 @@ "scripts": { "build": "rimraf lib && tsc -P ./tsconfig.build.json", "docs": "typedoc --out docs src/index.ts", - "lint": "npm-run-all -c -s tsc eslint", + "lint": "npm-run-all -c -s tsc eslint lint:browser", + "lint:browser": "cd tests/browser && npm run lint && cd ../..", "tsc": "tsc --noEmit", - "eslint": "eslint --ext ts,js src/ tests/", + "eslint": "eslint --ext ts,js src/ tests/integration tests/unit", "prepare": "cd tests/browser && npm install && cd ../..", "prepublishOnly": "npm run build", "test": "jest --testPathIgnorePatterns=\"integration/\"", diff --git a/tests/browser/cypress/e2e/login.cy.js b/tests/browser/cypress/e2e/login.cy.js index aecd0c1..4935c4b 100644 --- a/tests/browser/cypress/e2e/login.cy.js +++ b/tests/browser/cypress/e2e/login.cy.js @@ -11,9 +11,9 @@ describe('template spec', () => { cy.window().then((win) => { try { win.eval(functionCall); - } catch (e) { + } catch (error) { // eslint-disable-next-line no-console - console.error(e); + console.error(error); } }); }); diff --git a/tests/browser/cypress/support/e2e.ts b/tests/browser/cypress/support/e2e.ts index e69de29..5a8ea4d 100644 --- a/tests/browser/cypress/support/e2e.ts +++ b/tests/browser/cypress/support/e2e.ts @@ -0,0 +1 @@ +// this file is needed for the e2e tests diff --git a/tests/browser/package.json b/tests/browser/package.json index 22d759b..0d119c4 100644 --- a/tests/browser/package.json +++ b/tests/browser/package.json @@ -12,7 +12,10 @@ "clean": "rimraf lib/ .nyc_output/ coverage/ docs/ .parcel-cache/ dist/", "cypress:open": "cypress open", "cypress:run": "cypress run", - "test": "concurrently --kill-others \"npm run app\" \"npm run cypress:run\"" + "test": "concurrently --kill-others \"npm run app\" \"npm run cypress:run\"", + "lint": "npm-run-all -c -s eslint", + "tsc": "tsc --noEmit -P ./tsconfig.json", + "eslint": "eslint --ext ts,js cypress" }, "dependencies": { "dotenv": "^16.3.1" diff --git a/tests/browser/tsconfig.json b/tests/browser/tsconfig.json index 22d2083..560808e 100644 --- a/tests/browser/tsconfig.json +++ b/tests/browser/tsconfig.json @@ -1,8 +1,21 @@ { - // "extends": "../../tsconfig.json", + "extends": "../../tsconfig.json", "include": [ "../../node_modules/cypress", - "**/*.cy.js" + "**/*.cy.js", + "cypress/**/*.ts" + ], + "exclude": [ + "node_modules", + "build", + "./nyc_output", + "coverage", + "diff", + "./test.ts", + "./lib", + "./scrap.ts", + "../../src/", + "src" ], "compilerOptions": { "noEmit": true, diff --git a/tsconfig.build.json b/tsconfig.build.json index a425c20..1740bef 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -11,7 +11,8 @@ "./test.ts", "./lib", "./scrap*.ts", - "**/*.spec.ts" + "**/*.spec.ts", + "tests/browser", ], "filesGlob": [ "./src/**/*.ts" diff --git a/tsconfig.json b/tsconfig.json index 3272ec7..26249c0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,9 +4,9 @@ /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ - "target": "es2019", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */ + "target": "ES2019", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ - "lib": ["es2019"], /* Specify library files to be included in the compilation. */ + "lib": ["ES2019"], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */