diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 7d7289bc..00000000 --- a/.eslintignore +++ /dev/null @@ -1,61 +0,0 @@ -# Logs -logs -*.log - -# Runtime data -pids -*.pid -*.seed - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release -.eslintcache - -# Dependency directory -# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git -node_modules - -# OSX -.DS_Store - - -# App packaged -release -app/renderer.prod.js -app/renderer.prod.js.map -app/style.css -app/style.css.map -dist -dist_electron -dll -main.js -main.js.map - -.idea -npm-debug.log.* -__snapshots__ - -# Package.json -package.json -.travis.yml - -src/originalBudgetTrackingApp/web -src/originalBudgetTrackingApp/main* - -*.d.ts - -.eslintrc.js -ui-react/node_modules/** -ui-react/build/** diff --git a/package.json b/package.json index 39ede326..4ea6f94f 100644 --- a/package.json +++ b/package.json @@ -7,14 +7,13 @@ "main": "background.js", "private": true, "workspaces": [ - ".", - "ui-react" + "ui-react", + "src" ], "repository": "https://github.com/brafdlog/caspion", "homepage": "https://github.com/brafdlog/caspion#README.md", "scripts": { - "ui": "yarn workspace ui-react start", - "serve": "concurrently --kill-others-on-fail \"yarn serve-electron\" \"yarn ui\"", + "serve": "yarn workspaces run serve", "serve:debug": "concurrently --kill-others-on-fail \"yarn serve-electron:debug\" \"yarn ui\"", "serve-electron": "vue-cli-service electron:serve", "serve-electron:debug": "set DEBUG=israeli-bank-scrapers:* & vue-cli-service electron:serve --debug", @@ -24,10 +23,10 @@ "postinstall": "electron-builder install-app-deps", "postuninstall": "electron-builder install-app-deps", "prepare": "node scripts/copyCategoryCalculationScript.js && husky install", - "lint:backend": "eslint -f ./node_modules/eslint-friendly-formatter src test", + "lint:backend": "yarn workspace src lint", "lint:react": "yarn workspace ui-react lint", - "lint": "yarn lint:backend && yarn lint:react", - "lint:fix": "yarn lint --fix && yarn lint:react --fix", + "lint": "yarn workspaces run lint", + "lint:fix": "yarn workspaces run lint --fix", "typeCheck": "tsc --noEmit", "unit": "vue-cli-service test:unit", "e2e": "vue-cli-service test:unit --config='test/e2e/jest.e2e.config.js'", diff --git a/src/.eslintrc.js b/src/.eslintrc.js new file mode 100644 index 00000000..ec92a1a8 --- /dev/null +++ b/src/.eslintrc.js @@ -0,0 +1,99 @@ +const globals = require('../globals'); + +const readonlyGlobals = Object.keys(globals).reduce((acc, key) => { + acc[key] = 'readonly'; + return acc; +}, {}); + +const productionError = + process.env.NODE_ENV === 'production' ? 'error' : 'warn'; + +module.exports = { + root: true, + + parserOptions: { + parser: '@typescript-eslint/parser', + sourceType: 'module', + ecmaVersion: 2018, + }, + + env: { + browser: true, + node: true, + }, + + extends: [ + 'airbnb-base', + 'plugin:vue/recommended', + '@vue/typescript', + 'prettier', + ], + + globals: { + __static: 'writable', + ...readonlyGlobals, + }, + + plugins: ['import', 'vue', 'html'], + + settings: { + 'import/core-modules': ['electron'], + 'import/resolver': { + alias: { + map: [['@', './']], + extensions: ['.js', '.ts', '.vue', '.tsx'], + }, + }, + }, + + rules: { + // 'no-param-reassign': ['error', { ignorePropertyModificationsFor: ['state'] }], + 'no-param-reassign': 'off', + 'no-shadow': ['error', { allow: ['state'] }], + 'import/extensions': ['off'], + 'no-plusplus': ['error', { allowForLoopAfterthoughts: true }], + // allow debugger during development + 'no-debugger': productionError, + 'no-console': 'off', + 'linebreak-style': process.platform === 'win32' ? 0 : 2, + 'no-use-before-define': 'off', + 'max-len': ['error', { code: 160 }], + 'comma-dangle': 'off', + 'no-await-in-loop': 'off', + 'import/prefer-default-export': 'off', + 'no-unused-vars': 'off', + '@typescript-eslint/no-unused-vars': [ + 'error', + { args: 'after-used', argsIgnorePattern: '^_|h' }, + ], + 'arrow-body-style': 'off', + 'object-curly-newline': 'off', + semi: productionError, + 'padded-blocks': 'off', + 'no-return-assign': 'off', + 'quote-props': ['error', 'consistent-as-needed'], + 'no-restricted-imports': [ + 'error', + { + name: 'electron-log', + importNames: ['default'], + message: 'You should import from logging/logger instead', + }, + ], + }, + + overrides: [ + { + files: ['**/test/**/*.spec.{j,t}s', '**/*.test.{j,t}s'], + env: { + jest: true, + }, + rules: { + 'import/extensions': [ + 'error', + { js: 'never', vue: 'always', json: 'always' }, + ], + }, + }, + ], +}; diff --git a/src/package.json b/src/package.json new file mode 100644 index 00000000..d89c928f --- /dev/null +++ b/src/package.json @@ -0,0 +1,130 @@ +{ + "name": "src", + "version": "0.0.0", + "main": "background.js", + "private": true, + "scripts": { + "serve": "vue-cli-service electron:serve", + "serve:debug": "concurrently --kill-others-on-fail \"yarn serve-electron:debug\" \"yarn ui\"", + "serve-electron": "vue-cli-service electron:serve", + "serve-electron:debug": "set DEBUG=israeli-bank-scrapers:* & vue-cli-service electron:serve --debug", + "serve:docker": "yarn serve --no-sandbox", + "build": "vue-cli-service electron:build", + "prebuild": "yarn workspace ui-react build", + "postinstall": "electron-builder install-app-deps", + "postuninstall": "electron-builder install-app-deps", + "prepare": "node scripts/copyCategoryCalculationScript.js && husky install", + "lint": "eslint -f ../node_modules/eslint-friendly-formatter .", + "typeCheck": "tsc --noEmit", + "unit": "vue-cli-service test:unit", + "e2e": "vue-cli-service test:unit --config='test/e2e/jest.e2e.config.js'", + "test": "yarn unit && yarn e2e" + }, + "lint-staged": { + "**/*": "prettier --write --ignore-unknown" + }, + "dependencies": { + "@electron/remote": "^2.0.8", + "@sentry/electron": "^2.5.0", + "@vue/composition-api": "^1.0.0-rc.6", + "analytics-node": "^5.1.0", + "bottleneck": "^2.19.5", + "core-js": "^3.9.1", + "csv-parse": "^4.14.1", + "csv-stringify": "^5.6.2", + "direct-vuex": "^0.12.0", + "electron-devtools-installer": "^3.1.1", + "electron-google-oauth2": "^3.0.0", + "electron-log": "^4.1.1", + "electron-updater": "^5.2.4", + "emittery": "^0.10.0", + "googleapis": "^87.0.0", + "israeli-bank-scrapers-core": "4.0.3", + "keytar": "^7.4.0", + "lint-staged": "~13.2.3", + "lodash": "^4.17.15", + "moment": "^2.29.4", + "node-machine-id": "^1.1.12", + "puppeteer-core": "^5.5.0", + "vue": "^2.6.10", + "vue-router": "^3.1.6", + "vuetify": "^2.2.22", + "vuex": "^3.1.3", + "vuex-persist": "^3.1.3", + "ynab": "^1.19.0" + }, + "devDependencies": { + "@babel/core": "^7.9.0", + "@babel/plugin-proposal-class-properties": "^7.10.4", + "@babel/preset-env": "^7.9.5", + "@babel/preset-typescript": "^7.10.1", + "@babel/register": "^7.9.0", + "@semantic-release/changelog": "^6.0.1", + "@semantic-release/exec": "^6.0.3", + "@semantic-release/git": "^10.0.1", + "@types/analytics-node": "^3.1.4", + "@types/jest": "^26.0.22", + "@types/lodash": "^4.14.158", + "@types/node": "12", + "@types/puppeteer-core": "^5.4.0", + "@types/webdriverio": "^5.0.0", + "@typescript-eslint/eslint-plugin": "^3.7.0", + "@typescript-eslint/parser": "^3.2.0", + "@vue/cli-plugin-babel": "^4.5.12", + "@vue/cli-plugin-eslint": "^4.3.1", + "@vue/cli-plugin-router": "^4.5.12", + "@vue/cli-plugin-typescript": "^4.4.4", + "@vue/cli-plugin-unit-jest": "^4.5.4", + "@vue/cli-plugin-vuex": "^4.3.1", + "@vue/cli-service": "^4.3.1", + "@vue/compiler-dom": "^3.2.40", + "@vue/eslint-config-typescript": "^7.0.0", + "@vue/test-utils": "^1.0.3", + "babel-core": "^7.0.0-bridge.0", + "babel-eslint": "^10.1.0", + "babel-jest": "^26.3.0", + "babel-plugin-component": "^1.1.1", + "concurrently": "^6.3.0", + "conventional-changelog-eslint": "^3.0.9", + "electron": "^17.0.0", + "eslint": "^7.1.0", + "eslint-config-airbnb-base": "^14.1.0", + "eslint-config-prettier": "^9.0.0", + "eslint-friendly-formatter": "^4.0.1", + "eslint-import-resolver-alias": "^1.1.2", + "eslint-loader": "^4.0.2", + "eslint-plugin-html": "^6.0.2", + "eslint-plugin-import": "^2.20.2", + "eslint-plugin-jest": "^23.20.0", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-promise": "^4.3.1", + "eslint-plugin-standard": "^5.0.0", + "eslint-plugin-vue": "^7.8.0", + "husky": "^8.0.0", + "identity-obj-proxy": "^3.0.0", + "jest": "^26.4.2", + "jest-circus": "^26.4.2", + "jest-config": "^26.4.2", + "jest-each": "^26.4.2", + "jest-environment-node": "^26.6.2", + "ncp": "^2.0.0", + "node-loader": "^1.0.2", + "prettier": "^3.0.3", + "replace-in-file": "5.0.2", + "sass": "~1.32", + "sass-loader": "^10.0.0", + "semantic-release": "^19.0.5", + "spectron": "^19.0.0", + "ts-jest": "^26.3.0", + "typescript": "^3.9.7", + "vue-cli-plugin-electron-builder": "^2.1.1", + "vue-cli-plugin-vuetify": "^2.3.1", + "vue-jest": "4.0.0-beta.5", + "vue-template-compiler": "^2.6.11", + "vuetify-loader": "^1.4.4" + }, + "resolutions": { + "electron-builder": "^23.0.0" + }, + "packageManager": "yarn@1.22.19" +} diff --git a/ui-react/package.json b/ui-react/package.json index dbe70f79..686bb7cd 100644 --- a/ui-react/package.json +++ b/ui-react/package.json @@ -33,13 +33,12 @@ "fs-extra": "^10.1.0" }, "scripts": { - "start": "cross-env SKIP_PREFLIGHT_CHECK=true BROWSER=none react-scripts start", + "serve": "cross-env SKIP_PREFLIGHT_CHECK=true BROWSER=none react-scripts start", "build": "cross-env SKIP_PREFLIGHT_CHECK=true react-scripts build", "postbuild": "node copyReactArtifacts.js", "test": "react-scripts test", "eject": "react-scripts eject", - "lint": "eslint -f ../node_modules/eslint-friendly-formatter src", - "lint:fix": "yarn lint --fix" + "lint": "eslint -f ../node_modules/eslint-friendly-formatter src" }, "eslintConfig": { "extends": [ diff --git a/ui-react/src/index.tsx b/ui-react/src/index.tsx index 0d85687b..033b193d 100644 --- a/ui-react/src/index.tsx +++ b/ui-react/src/index.tsx @@ -12,7 +12,7 @@ ReactDOM.render( , - document.getElementById('root') + document.getElementById('root'), ); // If you want to start measuring performance in your app, pass a function @@ -26,6 +26,6 @@ function configureMobxLinting() { computedRequiresReaction: true, reactionRequiresObservable: true, observableRequiresReaction: true, - disableErrorBoundaries: true + disableErrorBoundaries: true, }); }