Skip to content
This repository has been archived by the owner on Nov 19, 2021. It is now read-only.

Commit

Permalink
Enable typescript support
Browse files Browse the repository at this point in the history
  • Loading branch information
Allypost committed Apr 8, 2021
1 parent d551db6 commit 462668c
Show file tree
Hide file tree
Showing 7 changed files with 562 additions and 166 deletions.
47 changes: 25 additions & 22 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,25 @@ module.exports = {
node: true,
},
parserOptions: {
parser: "@babel/eslint-parser",
parser: "@typescript-eslint/parser",
requireConfigFile: false,
},
extends: [
"plugin:@typescript-eslint/recommended",
"@nuxtjs",
"plugin:nuxt/recommended",
],
// add your custom rules here
rules: {
"no-dupe-class-members": "off",
"@typescript-eslint/no-var-requires": "off",
"vue/comment-directive": "off",
"nuxt/no-cjs-in-config": "off",
"space-before-function-paren": [
"error", {
"anonymous": "never",
"named": "never",
"asyncArrow": "always",
anonymous: "never",
named: "never",
asyncArrow: "always",
},
],
"vue/html-indent": [
Expand All @@ -29,16 +32,16 @@ module.exports = {
"vue/script-indent": [
"error", 2,
{
"baseIndent": 1,
"switchCase": 1,
baseIndent: 1,
switchCase: 1,
},
],
"indent": "off",
indent: "off",
"@typescript-eslint/indent": "off",
"array-bracket-spacing": [ "error", "always" ],
"arrow-parens": [ "error", "always" ],
"arrow-spacing": "error",
"camelcase": [
camelcase: [
"error",
{
ignoreDestructuring: true,
Expand All @@ -48,14 +51,14 @@ module.exports = {
"comma-spacing": [
"error",
{
"before": false,
"after": true,
before: false,
after: true,
},
],
"comma-style": [ "error", "last" ],
"computed-property-spacing": [ "error", "never" ],
"dot-notation": "error",
"eqeqeq": [ "error", "always" ],
eqeqeq: [ "error", "always" ],
"guard-for-in": "error",
"linebreak-style": [ "error", "unix" ],
"lines-between-class-members": [ "error", "always" ],
Expand All @@ -66,9 +69,9 @@ module.exports = {
"no-multiple-empty-lines": [
"error",
{
"max": 2,
"maxEOF": 1,
"maxBOF": 1,
max: 2,
maxEOF: 1,
maxBOF: 1,
},
],
"no-console": "warn",
Expand All @@ -84,7 +87,7 @@ module.exports = {
"no-useless-constructor": "error",
"object-curly-newline": [
"error", {
"ImportDeclaration": "always",
ImportDeclaration: "always",
},
],
"object-shorthand": [ "error", "always" ],
Expand All @@ -93,30 +96,30 @@ module.exports = {
"prefer-destructuring": [
"warn",
{
"array": true,
"object": true,
array: true,
object: true,
},
{
"enforceForRenamedProperties": false,
enforceForRenamedProperties: false,
},
],
"prefer-numeric-literals": "error",
"prefer-rest-params": "error",
"prefer-spread": "warn",
"prefer-template": "warn",
"quotes": [
quotes: [
"error",
"double",
{
"avoidEscape": true,
avoidEscape: true,
},
],
"semi": [ "error", "always" ],
semi: [ "error", "always" ],
"space-before-blocks": [ "warn", "always" ],
"space-infix-ops": "error",
"template-curly-spacing": [ "error", "always" ],
"template-tag-spacing": [ "error", "never" ],
"wrap-iife": [ "error", "inside" ],
"yoda": [ "error", "always", { "exceptRange": true } ],
yoda: [ "error", "always", { exceptRange: true } ],
},
};
2 changes: 1 addition & 1 deletion api/services/company-application-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default class CompanyApplicationService {
"application/pdf": "pdf",
"application/postscript": "ai",
};
};
}

static async areApplicationsEnabled() {
const setting = await SettingsService.getValue("Company Applications Enabled", "no");
Expand Down
2 changes: 1 addition & 1 deletion nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export default {
serverMiddleware: [
{
path: "/api",
handler: "~/api/index.js",
handler: "~/api/",
},
"~/middleware/logger",
],
Expand Down
21 changes: 15 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"author": "Josip Igrec",
"private": true,
"scripts": {
"dev": "node --inspect=0.0.0.0 node_modules/.bin/nuxt dev",
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate",
"lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
"dev": "node --inspect=0.0.0.0 ./node_modules/.bin/nuxt-ts dev",
"build": "nuxt-ts build",
"start": "nuxt-ts start",
"generate": "nuxt-ts generate",
"lint": "eslint --ext .ts,.js,.vue --ignore-path .gitignore .",
"stylelint": "stylelint --ignore-path .gitignore 'assets/**/*.{s?(a|c)ss,less,stylus}' '{components,layouts,pages}/**/*.vue'"
},
"lint-staged": {
Expand All @@ -26,6 +26,7 @@
"@ckeditor/ckeditor5-build-inline": "^19.0.0",
"@ckeditor/ckeditor5-vue": "^1.0.1",
"@fontsource/raleway": "^4.2.2",
"@nuxt/typescript-runtime": "^2.1.0",
"@nuxtjs/axios": "^5.3.6",
"@nuxtjs/dotenv": "^1.4.0",
"@nuxtjs/pwa": "^3.0.0-0",
Expand All @@ -35,9 +36,11 @@
"adm-zip": "^0.4.16",
"axios": "^0.21.1",
"body-parser": "^1.19.0",
"concurrently": "^6.0.1",
"content-disposition": "^0.5.3",
"cookie-parser": "^1.4.5",
"cookie-universal-nuxt": "^2.1.3",
"esbuild": "^0.11.6",
"express": "^4.17.1",
"express-fileupload": "^1.1.7-alpha.3",
"fuzzysearch": "^1.0.3",
Expand All @@ -53,6 +56,7 @@
"rimraf": "^3.0.2",
"sharp": "^0.25.2",
"soap": "^0.36.0",
"typescript": "^4.2.4",
"vue": "^2.6.11",
"vue-analytics": "^5.22.1",
"vue-pdf": "^4.1.0",
Expand All @@ -74,8 +78,13 @@
"@nuxtjs/google-analytics": "^2.3.0",
"@nuxtjs/stylelint-module": "^3.2.2",
"@nuxtjs/vuetify": "^1.11.2",
"@types/cookie-parser": "^1.4.2",
"@types/express-fileupload": "^1.1.6",
"@typescript-eslint/eslint-plugin": "^4.21.0",
"@typescript-eslint/parser": "^4.21.0",
"cssesc": "^3.0.0",
"eslint": "^6.1.0",
"eslint": "^7.23.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-nuxt": ">=0.4.2",
"husky": "^4.0.0",
"lint-staged": "^10.0.0",
Expand Down
1 change: 1 addition & 0 deletions shims.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
// eslint-disable-next-line no-unused-vars
declare const $style: { [index: string]: string };
84 changes: 84 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig.json to read more about this file */

/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
/* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
"target": "ESNext",
/* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
"module": "ESNext",
// "lib": [], /* Specify library files to be included in the compilation. */
/* Allow javascript files to be compiled. */
"allowJs": true,
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
// "outDir": "./", /* Redirect output structure to the directory. */
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "composite": true, /* Enable project compilation */
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
// "removeComments": true, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */

/* Strict Type-Checking Options */
/* Enable all strict type-checking options. */
// "strict": true,
/* Raise error on expressions and declarations with an implied 'any' type. */
// "noImplicitAny": true,
/* Enable strict null checks. */
"strictNullChecks": true,
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
/* Raise error on 'this' expressions with an implied 'any' type. */
"noImplicitThis": true,
/* Parse in strict mode and emit "use strict" for each source file. */
"alwaysStrict": true,
/* Additional Checks */
/* Report errors on unused locals. */
"noUnusedLocals": true,
/* Report errors on unused parameters. */
"noUnusedParameters": true,
/* Report error when not all code paths in function return a value. */
"noImplicitReturns": true,
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
// "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */

/* Module Resolution Options */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true,
/* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */

/* Source Map Options */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */

/* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */

/* Advanced Options */
/* Skip type checking of declaration files. */
"skipLibCheck": true,
/* Disallow inconsistently-cased references to the same file. */
"forceConsistentCasingInFileNames": true
}
}
Loading

0 comments on commit 462668c

Please sign in to comment.