mirror of
https://github.com/keeweb/keeweb.git
synced 2024-06-28 07:50:55 +02:00
TS setup
This commit is contained in:
parent
0800d5f33a
commit
73f94402dd
98
.eslintrc
98
.eslintrc
|
@ -1,6 +1,10 @@
|
|||
{
|
||||
"plugins": ["prettier", "import", "babel"],
|
||||
"extends": ["standard", "eslint:recommended", "plugin:prettier/recommended"],
|
||||
"plugins": ["prettier", "import", "babel", "react", "@typescript-eslint"],
|
||||
"extends": [
|
||||
"standard",
|
||||
"eslint:recommended",
|
||||
"plugin:prettier/recommended"
|
||||
],
|
||||
"rules": {
|
||||
"semi": ["error", "always"],
|
||||
"one-var": "off",
|
||||
|
@ -59,11 +63,99 @@
|
|||
}
|
||||
},
|
||||
"parser": "babel-eslint",
|
||||
"overrides": [{
|
||||
"files": ["app/scripts/**/*.js"],
|
||||
"rules": {
|
||||
"import/no-commonjs": "error"
|
||||
}
|
||||
}, {
|
||||
"files": ["*.ts", "*.tsx"],
|
||||
"extends": [
|
||||
"standard",
|
||||
"eslint:recommended",
|
||||
"preact",
|
||||
"plugin:prettier/recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
||||
"plugin:import/typescript"
|
||||
],
|
||||
"rules": {
|
||||
"semi": ["error", "always"],
|
||||
"one-var": "off",
|
||||
"space-before-function-paren": "off",
|
||||
"no-throw-literal": "off",
|
||||
"camelcase": ["error", { "properties": "always" }],
|
||||
"no-console": "error",
|
||||
"no-alert": "error",
|
||||
"no-debugger": "error",
|
||||
"prefer-arrow-callback": "error",
|
||||
"object-property-newline": "off",
|
||||
"no-useless-escape": "off",
|
||||
"no-var": "error",
|
||||
"prefer-const": "error",
|
||||
"no-unused-expressions": "off",
|
||||
"strict": ["error", "never"],
|
||||
"no-mixed-operators": "off",
|
||||
"prefer-promise-reject-errors": "off",
|
||||
"standard/no-callback-literal": "off",
|
||||
"object-curly-spacing": "off",
|
||||
"quote-props": "off",
|
||||
"no-new-object": "error",
|
||||
"object-shorthand": "error",
|
||||
"no-array-constructor": "error",
|
||||
"array-callback-return": "error",
|
||||
"no-eval": "error",
|
||||
"no-new-func": "error",
|
||||
"prefer-rest-params": "error",
|
||||
"prefer-spread": "error",
|
||||
"no-useless-constructor": "error",
|
||||
"no-dupe-class-members": "error",
|
||||
"no-duplicate-imports": "error",
|
||||
"eqeqeq": "error",
|
||||
"no-unneeded-ternary": "error",
|
||||
"curly": "error",
|
||||
"prettier/prettier": "error",
|
||||
"no-empty": "off",
|
||||
"no-restricted-syntax": [
|
||||
"error",
|
||||
{
|
||||
"selector": "ExportDefaultDeclaration",
|
||||
"message": "Prefer named exports"
|
||||
}
|
||||
],
|
||||
"import/no-webpack-loader-syntax": "off",
|
||||
"import/no-relative-parent-imports": "error",
|
||||
"import/first": "error",
|
||||
"import/no-default-export": "error",
|
||||
"babel/no-unused-expressions": "error",
|
||||
"node/no-callback-literal": "off",
|
||||
"import/no-commonjs": "error",
|
||||
"@typescript-eslint/no-unused-vars": "error",
|
||||
"@typescript-eslint/explicit-module-boundary-types": "error",
|
||||
"@typescript-eslint/restrict-template-expressions": "off"
|
||||
},
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaFeatures": {
|
||||
"jsx": true
|
||||
},
|
||||
"ecmaVersion": 11,
|
||||
"sourceType": "module",
|
||||
"project": ["tsconfig.json", "jsconfig.json"]
|
||||
}
|
||||
}],
|
||||
"settings": {
|
||||
"import/parsers": {
|
||||
"@typescript-eslint/parser": [".ts", ".tsx"]
|
||||
}
|
||||
},
|
||||
"globals": {
|
||||
"_": true,
|
||||
"$": true
|
||||
},
|
||||
"env": {
|
||||
"browser": true
|
||||
"browser": true,
|
||||
"node": true,
|
||||
"es2020": true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"rules": {
|
||||
"import/no-commonjs": "error"
|
||||
}
|
||||
}
|
|
@ -76,7 +76,8 @@ function config(options) {
|
|||
setImmediate: false,
|
||||
path: false,
|
||||
moment: false
|
||||
}
|
||||
},
|
||||
extensions: ['.tsx', '.ts', '.js']
|
||||
},
|
||||
resolveLoader: {
|
||||
modules: ['node_modules', path.join(__dirname, 'loaders')]
|
||||
|
@ -163,6 +164,11 @@ function config(options) {
|
|||
loader: 'babel-loader',
|
||||
options: { cacheDirectory: true }
|
||||
},
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
use: 'ts-loader',
|
||||
exclude: /node_modules/
|
||||
},
|
||||
{ test: /argon2\.wasm/, type: 'javascript/auto', loader: 'base64-loader' },
|
||||
{ test: /argon2(\.min)?\.js/, loader: 'raw-loader' },
|
||||
{
|
||||
|
|
2078
package-lock.json
generated
2078
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
|
@ -41,7 +41,6 @@
|
|||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-config-standard": "^16.0.2",
|
||||
"eslint-plugin-babel": "^5.3.1",
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-prettier": "^3.4.0",
|
||||
"eslint-plugin-promise": "5.1.0",
|
||||
|
@ -139,5 +138,14 @@
|
|||
"last 1 Opera version",
|
||||
"last 1 ChromeAndroid version",
|
||||
"Electron > 6.0.1"
|
||||
]
|
||||
],
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^4.22.1",
|
||||
"@typescript-eslint/parser": "^4.22.1",
|
||||
"eslint-config-preact": "^1.1.4",
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
"ts-loader": "^9.1.2",
|
||||
"ts-node": "^9.1.1",
|
||||
"typescript": "^4.2.4"
|
||||
}
|
||||
}
|
||||
|
|
16
tsconfig.json
Normal file
16
tsconfig.json
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2020",
|
||||
"module": "commonjs",
|
||||
"preserveConstEnums": true,
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"jsx": "react-jsx",
|
||||
"jsxImportSource": "preact",
|
||||
"baseUrl": "app/scripts",
|
||||
"noEmitOnError": true
|
||||
},
|
||||
"paths": {
|
||||
},
|
||||
"include": ["app/scripts/**/*"]
|
||||
}
|
Loading…
Reference in New Issue
Block a user