chore: fix eslint crashing issues (#1951)

This commit is contained in:
Mo
2022-11-04 17:09:54 -05:00
committed by GitHub
parent 5aa36ff071
commit 417c90a6f2
118 changed files with 315 additions and 424 deletions

View File

@@ -1,7 +0,0 @@
{
"extends": ["./node_modules/@standardnotes/config/src/.eslintrc"],
"rules": {
"max-classes-per-file": ["error", 1]
},
"ignorePatterns": [".eslintrc.js", "*.webpack.*.js", "webpack-defaults.js", "jest.config.js", "__mocks__", "**/**/coverage"]
}

60
common.eslintrc.js Normal file
View File

@@ -0,0 +1,60 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
plugins: ['@typescript-eslint', 'prettier'],
ignorePatterns: ['**/*.spec.ts'],
rules: {
'standard/no-callback-literal': 0, // Disable this as we have too many callbacks relying on literals
'no-throw-literal': 0,
camelcase: 'off',
'sort-imports': 'off',
'eol-last': 'error',
'no-multiple-empty-lines': ['error', { max: 1, maxEOF: 0 }],
'no-trailing-spaces': 'error',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': [
'error',
{
vars: 'all',
args: 'after-used',
ignoreRestSiblings: false,
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'@typescript-eslint/no-floating-promises': ['error'],
'block-scoped-var': 'error',
'comma-dangle': ['error', 'always-multiline'],
curly: ['error', 'all'],
'no-confusing-arrow': 'error',
'no-inline-comments': 'warn',
'no-invalid-this': 'error',
'no-return-assign': 'warn',
'no-constructor-return': 'error',
'no-duplicate-imports': 'error',
'no-self-compare': 'error',
'no-console': ['error', { allow: ['warn', 'error'] }],
'no-unmodified-loop-condition': 'error',
'no-unused-private-class-members': 'error',
'object-curly-spacing': ['error', 'always'],
quotes: ['error', 'single', { avoidEscape: true }],
semi: ['error', 'never'],
'prettier/prettier': [
'error',
{
singleQuote: true,
trailingComma: 'all',
printWidth: 120,
semi: false,
},
{
usePrettierrc: false,
},
],
},
}

View File

@@ -1,4 +0,0 @@
{
"exclude": ["node_modules"],
"extends": "./node_modules/@standardnotes/config/src/linter.tsconfig.json"
}

View File

@@ -1,3 +0,0 @@
node_modules
dist
coverage

View File

@@ -1,6 +0,0 @@
{
"extends": "../../.eslintrc",
"parserOptions": {
"project": "./linter.tsconfig.json"
}
}

View File

@@ -0,0 +1,9 @@
module.exports = {
root: true,
extends: ['../../common.eslintrc.js'],
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
ignorePatterns: ['**/*.spec.ts'],
}

View File

@@ -1,4 +0,0 @@
{
"extends": "./tsconfig.json",
"exclude": ["dist"]
}

View File

@@ -21,8 +21,8 @@
"start": "tsc -p tsconfig.json --watch",
"prebuild": "yarn clean",
"build": "tsc -p tsconfig.json",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"lint": "eslint src --ext .ts",
"lint:fix": "eslint src --ext .ts --fix",
"test": "jest spec --coverage"
},
"devDependencies": {

View File

@@ -1,3 +0,0 @@
node_modules
dist
jsign

View File

@@ -1,16 +0,0 @@
{
"env": {
"node": true,
"commonjs": true
},
"extends": ["../../.eslintrc.json"],
"rules": {
"no-console": "off",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-var-requires": "off"
},
"globals": {
"zip": true
},
"ignorePatterns": ["scripts"]
}

View File

@@ -0,0 +1,16 @@
module.exports = {
root: true,
extends: ['../../common.eslintrc.js'],
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
ignorePatterns: ['**/*.spec.ts', '@types', 'node_modules', 'dist'],
rules: {
'no-console': ['warn', { allow: ['warn', 'error'] }],
'@typescript-eslint/no-var-requires': 'off',
},
globals: {
zip: true,
},
}

View File

@@ -41,7 +41,7 @@ const loadAndStartApplication = async () => {
window.device = await createDesktopDevice(remoteBridge)
window.startApplication(DEFAULT_SYNC_SERVER, window.device, window.enableUnfinishedFeatures, WEBSOCKET_URL)
return window.startApplication(DEFAULT_SYNC_SERVER, window.device, window.enableUnfinishedFeatures, WEBSOCKET_URL)
}
window.onload = () => {
@@ -154,5 +154,5 @@ window.electronMainEvents.handleWindowFocused(() => {
})
window.electronMainEvents.handleInstallComponentComplete((_: IpcRendererEvent, data: any) => {
window.webClient.onComponentInstallationComplete(data.component, undefined)
void window.webClient.onComponentInstallationComplete(data.component, undefined)
})

View File

@@ -1,3 +0,0 @@
{
"extends": "../../node_modules/@standardnotes/config/src/linter.tsconfig.json"
}

View File

@@ -22,8 +22,8 @@
"dev": "NODE_ENV=development webpack --config desktop.webpack.dev.js --watch",
"format": "prettier --write .",
"lint:eslint": "eslint app/index.ts app/application.ts app/javascripts/**/*.ts",
"lint:formatting": "prettier --check .",
"lint": "yarn lint:formatting && yarn lint:eslint",
"lint:formatting": "prettier --check app",
"lint": "yarn lint:formatting && yarn lint:eslint app",
"tsc": "tsc --noEmit",
"release:mac": "node scripts/build.mjs mac",
"start": "electron ./app --enable-logging --icon _icon/icon.png",
@@ -58,7 +58,6 @@
"@types/proxyquire": "^1.3.28",
"@types/yauzl": "^2.10.0",
"ava": "^4.3.3",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.2.5",
"copy-webpack-plugin": "^10.2.4",
"electron-builder": "23.3.3",

View File

@@ -1,2 +0,0 @@
node_modules
dist

View File

@@ -1,10 +0,0 @@
{
"extends": "../../.eslintrc",
"parserOptions": {
"project": "./linter.tsconfig.json"
},
"rules": {
"@typescript-eslint/no-explicit-any": ["warn", { "ignoreRestArgs": true }],
"@typescript-eslint/no-non-null-assertion": "warn"
}
}

View File

@@ -0,0 +1,9 @@
module.exports = {
root: true,
extends: ['../../common.eslintrc.js'],
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
ignorePatterns: ['**/*.spec.ts'],
}

View File

@@ -1,4 +0,0 @@
{
"extends": "./tsconfig.json",
"exclude": ["dist"]
}

View File

@@ -18,7 +18,7 @@
"start": "tsc -p tsconfig.json --watch",
"prebuild": "yarn clean",
"build": "tsc -p tsconfig.json",
"lint": "eslint . --ext .ts",
"lint": "eslint src --ext .ts",
"format": "prettier --write src",
"test": "jest"
},

View File

@@ -1,2 +0,0 @@
node_modules
dist

View File

@@ -1,6 +0,0 @@
{
"extends": "../../.eslintrc",
"parserOptions": {
"project": "./linter.tsconfig.json"
}
}

View File

@@ -0,0 +1,9 @@
module.exports = {
root: true,
extends: ['../../common.eslintrc.js'],
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
ignorePatterns: ['**/*.spec.ts'],
}

View File

@@ -1,4 +0,0 @@
{
"extends": "./tsconfig.json",
"exclude": ["dist"]
}

View File

@@ -21,7 +21,7 @@
"start": "tsc -p tsconfig.json --watch",
"prebuild": "yarn clean",
"build": "tsc -p tsconfig.json",
"lint": "eslint . --ext .ts",
"lint": "eslint src --ext .ts",
"test": "jest"
},
"dependencies": {
@@ -32,7 +32,8 @@
},
"devDependencies": {
"@types/jest": "^28.1.5",
"@typescript-eslint/eslint-plugin": "^5.30.0",
"@typescript-eslint/eslint-plugin": "*",
"eslint": "*",
"eslint-plugin-prettier": "*",
"jest": "^28.1.2",
"ts-jest": "^28.0.5",

View File

@@ -1,3 +0,0 @@
node_modules
dist
example

View File

@@ -1,6 +0,0 @@
{
"extends": "../../.eslintrc",
"parserOptions": {
"project": "./linter.tsconfig.json"
}
}

View File

@@ -0,0 +1,9 @@
module.exports = {
root: true,
extends: ['../../common.eslintrc.js'],
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
ignorePatterns: ['**/*.spec.ts'],
}

View File

@@ -24,7 +24,6 @@
"@babel/preset-typescript": "^7.15.0",
"@standardnotes/config": "^2.2.0",
"@types/wicg-native-file-system": "^2020.6.0",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.2.3",
"html-webpack-plugin": "^5.5.0",
"ts-loader": "^9.2.6",

View File

@@ -1,4 +0,0 @@
{
"extends": "./tsconfig.json",
"exclude": ["dist", "example"]
}

View File

@@ -19,12 +19,13 @@
"start": "tsc -p tsconfig.json --watch",
"prebuild": "yarn clean",
"build": "tsc -p tsconfig.json",
"lint": "eslint . --ext .ts",
"lint": "eslint src --ext .ts",
"test": "jest"
},
"devDependencies": {
"@types/jest": "^28.1.5",
"@typescript-eslint/eslint-plugin": "^5.30.0",
"eslint": "*",
"eslint-plugin-prettier": "*",
"jest": "^28.1.2",
"ts-jest": "^28.0.5",

View File

@@ -1,2 +0,0 @@
node_modules
dist

View File

@@ -1,6 +0,0 @@
{
"extends": "../../.eslintrc",
"parserOptions": {
"project": "./linter.tsconfig.json"
}
}

View File

@@ -0,0 +1,9 @@
module.exports = {
root: true,
extends: ['../../common.eslintrc.js'],
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
ignorePatterns: ['**/*.spec.ts'],
}

View File

@@ -1,4 +0,0 @@
{
"extends": "./tsconfig.json",
"exclude": ["dist"]
}

View File

@@ -19,12 +19,13 @@
"start": "tsc -p tsconfig.json --watch",
"prebuild": "yarn clean",
"build": "tsc -p tsconfig.json",
"lint": "eslint . --ext .ts",
"lint": "eslint src --ext .ts",
"test": "jest"
},
"devDependencies": {
"@types/jest": "^28.1.5",
"@typescript-eslint/eslint-plugin": "^5.30.0",
"eslint": "*",
"eslint-plugin-prettier": "*",
"jest": "^28.1.2",
"ts-jest": "^28.0.5"

View File

@@ -1,9 +0,0 @@
metro.config.js
html/**/*
node_modules
ios
e2e
android
fastlane
WebFrame
__tests__

View File

@@ -1,14 +0,0 @@
{
"env": {
"node": true,
"commonjs": true
},
"extends": ["@react-native-community", "plugin:react-hooks/recommended", "../../.eslintrc.json"],
"rules": {
"no-console": "warn",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-var-requires": "off",
"eqeqeq": ["off"],
"no-void": ["off"]
}
}

View File

@@ -0,0 +1,13 @@
module.exports = {
root: true,
extends: ['../../common.eslintrc.js', 'plugin:react-hooks/recommended'],
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
ignorePatterns: ['**/*.spec.ts', '__mocks__'],
plugins: ['@typescript-eslint', 'react', 'react-hooks', 'prettier'],
rules: {
'no-console': 'warn',
}
}

View File

@@ -17,7 +17,7 @@
"ios-dev": "react-native run-ios --scheme StandardNotesDev",
"ios-prod": "react-native run-ios --scheme StandardNotes",
"lint:fix": "yarn lint --fix",
"lint": "yarn tsc && yarn eslint . --ext .ts,.tsx",
"lint": "yarn eslint src --ext .ts,.tsx",
"pods": "yarn install:pods",
"start": "react-native start",
"tsc": "tsc --noEmit",

View File

@@ -17,16 +17,5 @@
"target": "esnext",
"typeRoots": ["node_modules/@types", "./src/Types/*"]
},
"exclude": [
"node_modules",
"babel.config.js",
"metro.config.js",
"jest.config.js",
"e2e",
"html",
"android",
"WebFrame",
"ios",
"fastlane"
]
"include": ["src"]
}

View File

@@ -1,2 +0,0 @@
node_modules
dist

View File

@@ -1,10 +0,0 @@
{
"extends": "../../.eslintrc",
"parserOptions": {
"project": "./linter.tsconfig.json"
},
"rules": {
"@typescript-eslint/no-explicit-any": ["warn", { "ignoreRestArgs": true }],
"@typescript-eslint/no-non-null-assertion": "warn"
}
}

View File

@@ -0,0 +1,9 @@
module.exports = {
root: true,
extends: ['../../common.eslintrc.js'],
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
ignorePatterns: ['**/*.spec.ts'],
}

View File

@@ -1,4 +0,0 @@
{
"extends": "./tsconfig.json",
"exclude": ["dist"]
}

View File

@@ -18,7 +18,7 @@
"start": "tsc -p tsconfig.json --watch",
"prebuild": "yarn clean",
"build": "tsc -p tsconfig.json",
"lint": "eslint . --ext .ts",
"lint": "eslint src --ext .ts",
"test": "jest"
},
"devDependencies": {

View File

@@ -9,5 +9,5 @@
"src/**/*"
],
"references": [],
"exclude": ["**/*.spec.ts", "dist", "node_modules"]
"exclude": ["**/*.spec.ts"]
}

View File

@@ -1,3 +0,0 @@
node_modules
dist
coverage

View File

@@ -1,6 +0,0 @@
{
"extends": "../../.eslintrc",
"parserOptions": {
"project": "./linter.tsconfig.json"
}
}

View File

@@ -0,0 +1,9 @@
module.exports = {
root: true,
extends: ['../../common.eslintrc.js'],
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
ignorePatterns: ['**/*.spec.ts'],
}

View File

@@ -1,4 +0,0 @@
{
"extends": "./tsconfig.json",
"exclude": ["dist"]
}

View File

@@ -20,12 +20,13 @@
"start": "tsc -p tsconfig.json --watch",
"prebuild": "yarn clean",
"build": "tsc -p tsconfig.json",
"lint": "eslint . --ext .ts",
"lint": "eslint src --ext .ts",
"test": "jest spec --coverage --passWithNoTests"
},
"devDependencies": {
"@types/jest": "^28.1.5",
"@typescript-eslint/eslint-plugin": "^5.30.0",
"eslint": "*",
"eslint-plugin-prettier": "*",
"jest": "^28.1.2",
"ts-jest": "^28.0.5"

View File

@@ -1,3 +0,0 @@
node_modules
dist
coverage

View File

@@ -1,9 +0,0 @@
{
"extends": "../../.eslintrc",
"parserOptions": {
"project": "./linter.tsconfig.json"
},
"rules": {
"@typescript-eslint/no-explicit-any": ["warn", { "ignoreRestArgs": true }]
}
}

View File

@@ -0,0 +1,9 @@
module.exports = {
root: true,
extends: ['../../common.eslintrc.js'],
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
ignorePatterns: ['**/*.spec.ts'],
}

View File

@@ -1,4 +0,0 @@
{
"extends": "./tsconfig.json",
"exclude": ["dist"]
}

View File

@@ -19,8 +19,8 @@
"start": "tsc -p tsconfig.json --watch",
"prebuild": "yarn clean",
"build": "tsc -p tsconfig.json",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"lint": "eslint src --ext .ts",
"lint:fix": "eslint src --ext .ts --fix",
"test": "jest spec --coverage"
},
"dependencies": {

View File

@@ -1 +0,0 @@
dist

View File

@@ -1,6 +0,0 @@
{
"extends": "../../.eslintrc",
"parserOptions": {
"project": "./linter.tsconfig.json"
}
}

View File

@@ -0,0 +1,9 @@
module.exports = {
root: true,
extends: ['../../common.eslintrc.js'],
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
ignorePatterns: ['**/*.spec.ts'],
}

View File

@@ -1,4 +0,0 @@
{
"extends": "./tsconfig.json",
"exclude": ["dist"]
}

View File

@@ -20,12 +20,13 @@
"prebuild": "yarn clean",
"build": "tsc -p tsconfig.json",
"watch": "tsc -p tsconfig.json --watch",
"lint": "eslint . --ext .ts",
"lint": "eslint src --ext .ts",
"test": "yarn lint"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.30.0",
"@typescript-eslint/parser": "^5.12.1",
"eslint": "*",
"eslint-plugin-prettier": "^4.2.1",
"typescript": "*"
},

View File

@@ -1,4 +0,0 @@
dist
test
*.config.js
test-server.js

View File

@@ -1,6 +0,0 @@
{
"extends": "../../.eslintrc",
"parserOptions": {
"project": "./linter.tsconfig.json"
}
}

View File

@@ -0,0 +1,9 @@
module.exports = {
root: true,
extends: ['../../common.eslintrc.js'],
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
ignorePatterns: ['**/*.spec.ts'],
}

View File

@@ -1,4 +0,0 @@
{
"extends": "./tsconfig.json",
"exclude": ["dist"]
}

View File

@@ -19,7 +19,7 @@
"prebuild": "yarn clean",
"build": "webpack --mode production && tsc",
"watch": "webpack --mode production --watch",
"lint": "eslint . --ext .ts",
"lint": "eslint src --ext .ts",
"test:e2e": "node test-server.js"
},
"dependencies": {

View File

@@ -1,9 +0,0 @@
node_modules
dist
test
*.config.js
mocha/**/*
coverage
e2e-server.js
jest-global.ts
webpack.*.js

View File

@@ -1,9 +0,0 @@
{
"extends": "../../.eslintrc.json",
"parserOptions": {
"project": "./linter.tsconfig.json"
},
"rules": {
"@typescript-eslint/no-explicit-any": ["warn", { "ignoreRestArgs": true }]
}
}

View File

@@ -0,0 +1,9 @@
module.exports = {
root: true,
extends: ['../../common.eslintrc.js'],
parserOptions: {
project: './lib/tsconfig.json',
tsconfigRootDir: __dirname,
},
ignorePatterns: ['**/*.spec.ts'],
}

View File

@@ -1,22 +0,0 @@
{
"source": {
"includePattern": ".+\\.js(doc|x)?$",
"include": ["lib"],
"exclude": ["node_modules"]
},
"recurseDepth": 10,
"opts": {
"destination": "./docs/",
"recurse": true,
"template": "node_modules/docdash"
},
"tags": {
"allowUnknownTags": true,
"dictionaries": ["jsdoc", "closure"]
},
"docdash": {
"meta": {
"title": "SNJS Documentation"
}
}
}

View File

@@ -24,7 +24,7 @@
"build": "yarn tsc && webpack --config webpack.prod.js",
"docs": "jsdoc -c jsdoc.json",
"tsc": "tsc --project lib/tsconfig.json && tscpaths -p lib/tsconfig.json -s lib -o dist/@types",
"lint": "yarn lint:tsc && yarn lint:eslint",
"lint": "yarn lint:eslint lib",
"lint:eslint": "eslint --ext .ts lib/",
"lint:fix": "eslint --fix --ext .ts lib/",
"lint:tsc": "tsc --noEmit --emitDeclarationOnly false --project lib/tsconfig.json",

View File

@@ -1,3 +0,0 @@
node_modules
dist
webpack.config.js

View File

@@ -0,0 +1,9 @@
module.exports = {
root: true,
extends: ['../../common.eslintrc.js'],
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
ignorePatterns: ['**/*.spec.ts'],
}

View File

@@ -1,4 +0,0 @@
{
"extends": ["../../node_modules/@standardnotes/config/src/.eslintrc"],
"ignorePatterns": [".eslintrc.js", "webpack.config.js"]
}

View File

@@ -1,3 +0,0 @@
{
"extends": "../../node_modules/@standardnotes/config/src/linter.tsconfig.json"
}

View File

@@ -1,2 +0,0 @@
node_modules
dist

View File

@@ -0,0 +1,9 @@
module.exports = {
root: true,
extends: ['../../common.eslintrc.js'],
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
ignorePatterns: ['**/*.spec.ts'],
}

View File

@@ -1,4 +0,0 @@
{
"extends": ["../../node_modules/@standardnotes/config/src/.eslintrc"],
"ignorePatterns": [".eslintrc.js", "*.webpack.*.js", "webpack-defaults.js", "jest.config.js", "__mocks__"]
}

View File

@@ -1,3 +0,0 @@
{
"extends": "../../node_modules/@standardnotes/config/src/linter.tsconfig.json"
}

View File

@@ -1,3 +0,0 @@
node_modules
dist
coverage

View File

@@ -1,9 +0,0 @@
{
"extends": "../../.eslintrc",
"parserOptions": {
"project": "./linter.tsconfig.json"
},
"rules": {
"@typescript-eslint/no-explicit-any": ["warn", { "ignoreRestArgs": true }]
}
}

View File

@@ -0,0 +1,9 @@
module.exports = {
root: true,
extends: ['../../common.eslintrc.js'],
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
ignorePatterns: ['**/*.spec.ts'],
}

View File

@@ -1,4 +0,0 @@
{
"extends": "./tsconfig.json",
"exclude": ["dist"]
}

View File

@@ -19,7 +19,7 @@
"start": "tsc -p tsconfig.json --watch",
"prebuild": "yarn clean",
"build": "tsc -p tsconfig.json",
"lint": "eslint . --ext .ts",
"lint": "eslint src --ext .ts",
"test": "jest spec"
},
"dependencies": {
@@ -35,6 +35,7 @@
"@types/jest": "^28.1.5",
"@typescript-eslint/eslint-plugin": "^5.30.0",
"@typescript-eslint/parser": "^5.12.1",
"eslint": "*",
"eslint-plugin-prettier": "*",
"jest": "^28.1.2",
"ts-jest": "^28.0.5",

View File

@@ -1,2 +0,0 @@
node_modules
dist

View File

@@ -1,6 +0,0 @@
{
"extends": "../../.eslintrc",
"parserOptions": {
"project": "./linter.tsconfig.json"
}
}

View File

@@ -0,0 +1,9 @@
module.exports = {
root: true,
extends: ['../../common.eslintrc.js'],
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
ignorePatterns: ['**/*.spec.ts'],
}

View File

@@ -1,4 +0,0 @@
{
"extends": "./tsconfig.json",
"exclude": ["dist"]
}

View File

@@ -21,7 +21,7 @@
"start": "tsc -p tsconfig.json --watch",
"prebuild": "yarn clean",
"build": "tsc -p tsconfig.json",
"lint": "eslint . --ext .ts",
"lint": "eslint src --ext .ts",
"test": "jest spec"
},
"dependencies": {
@@ -37,6 +37,7 @@
"@types/lodash": "^4.14.179",
"@types/node": "^18.0.0",
"@typescript-eslint/eslint-plugin": "^5.30.0",
"eslint": "*",
"eslint-plugin-prettier": "*",
"jest": "^28.1.2",
"jsdom": "^20.0.0",

View File

@@ -1,7 +0,0 @@
dist
node_modules
web.webpack-defaults.js
coverage
src/components
src/favicon
src/vendor

View File

@@ -1,47 +0,0 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"plugin:react-hooks/recommended",
"../../node_modules/@standardnotes/config/src/.eslintrc"
],
"plugins": ["@typescript-eslint", "react", "react-hooks"],
"ignorePatterns": [
"node_modules",
"dist",
".eslintrc.js",
"*.webpack.*.js",
"webpack-defaults.js",
"jest.config.js",
"__mocks__",
"src/components",
"src/favicon",
"src/vendor",
"coverage",
"*.config.js"
],
"rules": {
"standard/no-callback-literal": 0, // Disable this as we have too many callbacks relying on literals
"no-throw-literal": 0,
"no-console": ["warn", { "allow": ["warn", "error"] }],
"semi": 1,
"camelcase": "warn",
"sort-imports": "off",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "error",
"eol-last": "error",
"no-multiple-empty-lines": ["error", { "max": 1, "maxEOF": 0 }],
"no-trailing-spaces": "error",
"@typescript-eslint/no-explicit-any": "warn",
"no-invalid-this": "warn"
},
"env": {
"browser": true
},
"globals": {
"__WEB_VERSION__": true
}
}

16
packages/web/.eslintrc.js Normal file
View File

@@ -0,0 +1,16 @@
module.exports = {
root: true,
extends: ['../../common.eslintrc.js', 'plugin:react-hooks/recommended'],
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
ignorePatterns: ['**/*.spec.ts', "__mocks__"],
plugins: ['@typescript-eslint', 'react', 'react-hooks', 'prettier'],
env: {
browser: true,
},
globals: {
__WEB_VERSION__: true,
},
}

View File

@@ -48,7 +48,7 @@ const ComponentView: FunctionComponent<IProps> = ({ application, onLoad, compone
const component: SNComponent = componentViewer.component
const manageSubscription = useCallback(() => {
openSubscriptionDashboard(application)
void openSubscriptionDashboard(application)
}, [application])
const reloadValidityStatus = useCallback(() => {

View File

@@ -214,9 +214,9 @@ const ContentListView: FunctionComponent<Props> = ({
const panelResizeFinishCallback: ResizeFinishCallback = useCallback(
(width, _lastLeft, _isMaxWidth, isCollapsed) => {
if (selectedAsTag) {
navigationController.setPanelWidthForTag(selectedAsTag, width)
void navigationController.setPanelWidthForTag(selectedAsTag, width)
} else {
application.setPreference(PrefKey.NotesPanelWidth, width).catch(console.error)
void application.setPreference(PrefKey.NotesPanelWidth, width).catch(console.error)
}
application.publishPanelDidResizeEvent(PANEL_NAME_NOTES, isCollapsed)
},

View File

@@ -113,7 +113,7 @@ const DailyContentList: FunctionComponent<Props> = ({
const onClickTemplate = useCallback(
(date: Date) => {
setSelectedDay(date)
itemListController.createNewNote(undefined, date, 'editor')
void itemListController.createNewNote(undefined, date, 'editor')
toggleAppPane(AppPaneId.Editor)
},
[setSelectedDay, itemListController, toggleAppPane],

View File

@@ -101,7 +101,7 @@ const DisplayOptionsMenu: FunctionComponent<DisplayOptionsMenuProps> = ({
)
const resetTagPreferences = useCallback(() => {
application.mutator.changeAndSaveItem<TagMutator>(selectedTag, (mutator) => {
void application.mutator.changeAndSaveItem<TagMutator>(selectedTag, (mutator) => {
mutator.preferences = undefined
})
}, [application, selectedTag])

View File

@@ -101,7 +101,7 @@ const NewNotePreferences: FunctionComponent<Props> = ({
const setNewNoteTitleFormatChange = (value: string) => {
setNewNoteTitleFormat(value as NewNoteTitleFormat)
if (mode === 'global') {
application.setPreference(PrefKey.NewNoteTitleFormat, value as NewNoteTitleFormat)
void application.setPreference(PrefKey.NewNoteTitleFormat, value as NewNoteTitleFormat)
} else {
void changePreferencesCallback({ newNoteTitleFormat: value as NewNoteTitleFormat })
}
@@ -168,7 +168,7 @@ const NewNotePreferences: FunctionComponent<Props> = ({
if (mode === 'tag') {
void changePreferencesCallback({ customNoteTitleFormat: newFormat })
} else {
application.setPreference(PrefKey.CustomNoteTitleFormat, newFormat)
void application.setPreference(PrefKey.CustomNoteTitleFormat, newFormat)
}
}, PrefChangeDebounceTimeInMs)
}

View File

@@ -50,7 +50,7 @@ const PreviewComponent: FunctionComponent<Props> = ({ application, file, bytes }
}),
)
application.mobileDevice().previewFile(fileBase64, file.name)
void application.mobileDevice().previewFile(fileBase64, file.name)
}, [application, bytes, file.mimeType, file.name, isNativeMobileWeb])
useEffect(() => {

View File

@@ -61,14 +61,14 @@ const LinkedItemBubble = ({
const onUnlinkClick: MouseEventHandler = (event) => {
event.stopPropagation()
unlinkItem(link)
void unlinkItem(link)
}
const onKeyDown: KeyboardEventHandler = (event) => {
switch (event.key) {
case KeyboardKey.Backspace: {
focusPreviousItem()
unlinkItem(link)
void unlinkItem(link)
break
}
case KeyboardKey.Left:

Some files were not shown because too many files have changed in this diff Show More