Skip to content

Commit

Permalink
lint works with workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
baruchiro committed Jan 11, 2024
1 parent b798a7c commit ec2a083
Show file tree
Hide file tree
Showing 6 changed files with 239 additions and 73 deletions.
61 changes: 0 additions & 61 deletions .eslintignore

This file was deleted.

13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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'",
Expand Down
99 changes: 99 additions & 0 deletions src/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -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' },
],
},
},
],
};
130 changes: 130 additions & 0 deletions src/package.json
Original file line number Diff line number Diff line change
@@ -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": "[email protected]"
}
5 changes: 2 additions & 3 deletions ui-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
4 changes: 2 additions & 2 deletions ui-react/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
document.getElementById('root'),
);

// If you want to start measuring performance in your app, pass a function
Expand All @@ -26,6 +26,6 @@ function configureMobxLinting() {
computedRequiresReaction: true,
reactionRequiresObservable: true,
observableRequiresReaction: true,
disableErrorBoundaries: true
disableErrorBoundaries: true,
});
}

0 comments on commit ec2a083

Please sign in to comment.