Compare commits
8 Commits
Author | SHA1 | Date |
---|---|---|
Alice Gaudon | a5b7cf9268 | |
Alice Gaudon | 11fccbfc0d | |
Alice Gaudon | e94b98aee0 | |
Alice Gaudon | 47156c9a77 | |
Alice Gaudon | 5f5275ceb1 | |
Alice Gaudon | eb0364a2f7 | |
Alice Gaudon | f2f34dd00f | |
Alice Gaudon | 8c1230d501 |
|
@ -0,0 +1,135 @@
|
|||
module.exports = {
|
||||
root: true,
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: [
|
||||
'svelte3',
|
||||
'@typescript-eslint',
|
||||
'import',
|
||||
'simple-import-sort',
|
||||
],
|
||||
parserOptions: {
|
||||
tsconfigRootDir: __dirname,
|
||||
project: [
|
||||
'./tsconfig.test.json',
|
||||
'./src/tsconfig.json',
|
||||
'./src/common/tsconfig.json',
|
||||
'./src/assets/ts/tsconfig.eslint.json',
|
||||
'./src/assets/views/tsconfig.json',
|
||||
]
|
||||
},
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
],
|
||||
rules: {
|
||||
indent: [
|
||||
'error',
|
||||
4,
|
||||
{
|
||||
SwitchCase: 1
|
||||
}
|
||||
],
|
||||
'no-trailing-spaces': 'error',
|
||||
'max-len': [
|
||||
'error',
|
||||
{
|
||||
code: 120,
|
||||
ignoreTemplateLiterals: true,
|
||||
ignoreRegExpLiterals: true
|
||||
}
|
||||
],
|
||||
semi: 'off',
|
||||
'@typescript-eslint/semi': [
|
||||
'error'
|
||||
],
|
||||
'no-extra-semi': 'error',
|
||||
'eol-last': 'error',
|
||||
'comma-dangle': 'off',
|
||||
'simple-import-sort/imports': 'error',
|
||||
'no-extra-parens': 'off',
|
||||
'no-nested-ternary': 'error',
|
||||
'no-return-await': 'off',
|
||||
'no-useless-return': 'error',
|
||||
'no-useless-constructor': 'off',
|
||||
'import/extensions': ['error', 'ignorePackages'],
|
||||
'@typescript-eslint/comma-dangle': [
|
||||
'error',
|
||||
{
|
||||
arrays: 'always-multiline',
|
||||
objects: 'always-multiline',
|
||||
imports: 'always-multiline',
|
||||
exports: 'always-multiline',
|
||||
functions: 'always-multiline',
|
||||
enums: 'always-multiline',
|
||||
generics: 'always-multiline',
|
||||
tuples: 'always-multiline'
|
||||
}
|
||||
],
|
||||
'@typescript-eslint/no-extra-parens': [
|
||||
'error'
|
||||
],
|
||||
'@typescript-eslint/no-inferrable-types': 'off',
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'error',
|
||||
'@typescript-eslint/no-unnecessary-condition': 'error',
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
'error',
|
||||
{
|
||||
argsIgnorePattern: '^_'
|
||||
}
|
||||
],
|
||||
'@typescript-eslint/no-non-null-assertion': 'error',
|
||||
'@typescript-eslint/no-useless-constructor': [
|
||||
'error'
|
||||
],
|
||||
'@typescript-eslint/return-await': [
|
||||
'error',
|
||||
'always'
|
||||
],
|
||||
'@typescript-eslint/explicit-member-accessibility': [
|
||||
'error',
|
||||
{
|
||||
accessibility: 'explicit'
|
||||
}
|
||||
],
|
||||
'@typescript-eslint/no-floating-promises': 'error',
|
||||
},
|
||||
ignorePatterns: [
|
||||
'.eslintrc.js',
|
||||
'rollup.config.js',
|
||||
'jest.config.js',
|
||||
'dist/**/*',
|
||||
'config/**/*',
|
||||
'intermediates/**/*',
|
||||
'public/**/*',
|
||||
'scripts/**/*',
|
||||
'src/frontend/register_svelte/register_svelte.js',
|
||||
],
|
||||
overrides: [
|
||||
{
|
||||
files: [
|
||||
'test/**/*'
|
||||
],
|
||||
rules: {
|
||||
'max-len': [
|
||||
'error',
|
||||
{
|
||||
code: 120,
|
||||
ignoreTemplateLiterals: true,
|
||||
ignoreRegExpLiterals: true,
|
||||
ignoreStrings: true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
files: ['*.svelte'],
|
||||
processor: 'svelte3/svelte3'
|
||||
}
|
||||
],
|
||||
settings: {
|
||||
'svelte3/typescript': require('typescript'),
|
||||
'svelte3/ignore-styles': function (attributes) {
|
||||
return !!(attributes['lang'] && attributes['lang'] !== 'css');
|
||||
}
|
||||
},
|
||||
}
|
115
.eslintrc.json
115
.eslintrc.json
|
@ -1,115 +0,0 @@
|
|||
{
|
||||
"root": true,
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"plugins": [
|
||||
"@typescript-eslint"
|
||||
],
|
||||
"parserOptions": {
|
||||
"project": [
|
||||
"./tsconfig.json",
|
||||
"./tsconfig.test.json",
|
||||
"./tsconfig.frontend.json"
|
||||
]
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/recommended"
|
||||
],
|
||||
"rules": {
|
||||
"indent": [
|
||||
"error",
|
||||
4,
|
||||
{
|
||||
"SwitchCase": 1
|
||||
}
|
||||
],
|
||||
"no-trailing-spaces": "error",
|
||||
"max-len": [
|
||||
"error",
|
||||
{
|
||||
"code": 120,
|
||||
"ignoreStrings": true,
|
||||
"ignoreTemplateLiterals": true,
|
||||
"ignoreRegExpLiterals": true
|
||||
}
|
||||
],
|
||||
"semi": "off",
|
||||
"@typescript-eslint/semi": [
|
||||
"error"
|
||||
],
|
||||
"no-extra-semi": "error",
|
||||
"eol-last": "error",
|
||||
"comma-dangle": "off",
|
||||
"@typescript-eslint/comma-dangle": [
|
||||
"error",
|
||||
{
|
||||
"arrays": "always-multiline",
|
||||
"objects": "always-multiline",
|
||||
"imports": "always-multiline",
|
||||
"exports": "always-multiline",
|
||||
"functions": "always-multiline",
|
||||
"enums": "always-multiline",
|
||||
"generics": "always-multiline",
|
||||
"tuples": "always-multiline"
|
||||
}
|
||||
],
|
||||
"no-extra-parens": "off",
|
||||
"@typescript-eslint/no-extra-parens": [
|
||||
"error"
|
||||
],
|
||||
"no-nested-ternary": "error",
|
||||
"@typescript-eslint/no-inferrable-types": "off",
|
||||
"@typescript-eslint/explicit-module-boundary-types": "error",
|
||||
"@typescript-eslint/no-unnecessary-condition": "error",
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
"argsIgnorePattern": "^_"
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/no-non-null-assertion": "error",
|
||||
"no-useless-return": "error",
|
||||
"no-useless-constructor": "off",
|
||||
"@typescript-eslint/no-useless-constructor": [
|
||||
"error"
|
||||
],
|
||||
"no-return-await": "off",
|
||||
"@typescript-eslint/return-await": [
|
||||
"error",
|
||||
"always"
|
||||
],
|
||||
"@typescript-eslint/explicit-member-accessibility": [
|
||||
"error",
|
||||
{
|
||||
"accessibility": "explicit"
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/no-floating-promises": "error"
|
||||
},
|
||||
"ignorePatterns": [
|
||||
"jest.config.js",
|
||||
"scripts/**/*",
|
||||
"webpack.config.js",
|
||||
"dist/**/*",
|
||||
"public/**/*",
|
||||
"config/**/*"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"test/**/*"
|
||||
],
|
||||
"rules": {
|
||||
"max-len": [
|
||||
"error",
|
||||
{
|
||||
"code": 120,
|
||||
"ignoreTemplateLiterals": true,
|
||||
"ignoreRegExpLiterals": true,
|
||||
"ignoreStrings": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
22
package.json
22
package.json
|
@ -18,32 +18,34 @@
|
|||
"start": "yarn build-production && node ."
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tsconfig/svelte": "^2.0.1",
|
||||
"@types/config": "^0.0.40",
|
||||
"@tsconfig/svelte": "^3.0.0",
|
||||
"@types/config": "^0.0.41",
|
||||
"@types/express": "^4.17.6",
|
||||
"@types/express-session": "^1.17.0",
|
||||
"@types/feather-icons": "^4.7.0",
|
||||
"@types/formidable": "^2.0.0",
|
||||
"@types/jest": "^27.0.3",
|
||||
"@types/mysql": "^2.15.15",
|
||||
"@types/node": "^16.11.9",
|
||||
"@types/node": "^17.0.4",
|
||||
"@types/nodemailer": "^6.4.0",
|
||||
"@types/nunjucks": "^3.1.3",
|
||||
"@types/ws": "^8.2.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
||||
"@typescript-eslint/parser": "^5.4.0",
|
||||
"concurrently": "^6.0.0",
|
||||
"eslint": "^8.2.0",
|
||||
"feather-icons": "^4.28.0",
|
||||
"concurrently": "^7.0.0",
|
||||
"eslint": "^8.3.0",
|
||||
"eslint-plugin-import": "^2.25.3",
|
||||
"eslint-plugin-simple-import-sort": "^7.0.0",
|
||||
"eslint-plugin-svelte3": "^3.2.1",
|
||||
"imagemin-gifsicle": "^7.0.0",
|
||||
"imagemin-mozjpeg": "^9.0.0",
|
||||
"imagemin-mozjpeg": "^10.0.0",
|
||||
"imagemin-pngquant": "^9.0.2",
|
||||
"imagemin-svgo": "^10.0.0",
|
||||
"imagemin-webp": "^6.0.0",
|
||||
"imagemin-webp": "^7.0.0",
|
||||
"jest": "^27.0.4",
|
||||
"maildev": "^1.1.0",
|
||||
"nodemon": "^2.0.3",
|
||||
"sass": "^1.32.12",
|
||||
"svelte": "^3.44.2",
|
||||
"svgo": "^2.3.0",
|
||||
"ts-jest": "^27.0.3",
|
||||
"typescript": "^4.0.2"
|
||||
|
@ -51,6 +53,6 @@
|
|||
"dependencies": {
|
||||
"config": "^3.3.1",
|
||||
"express": "^4.17.1",
|
||||
"swaf": "^0.24.7"
|
||||
"swaf": "^0.25.1"
|
||||
}
|
||||
}
|
||||
|
|
35
src/App.ts
35
src/App.ts
|
@ -1,30 +1,31 @@
|
|||
import Application from "swaf/Application";
|
||||
import Migration, {MigrationType} from "swaf/db/Migration";
|
||||
import CreateMigrationsTable from "swaf/migrations/CreateMigrationsTable";
|
||||
import AutoUpdateComponent from "swaf/components/AutoUpdateComponent";
|
||||
import CsrfProtectionComponent from "swaf/components/CsrfProtectionComponent";
|
||||
import ExpressAppComponent from "swaf/components/ExpressAppComponent";
|
||||
import MysqlComponent from "swaf/components/MysqlComponent";
|
||||
import FormHelperComponent from "swaf/components/FormHelperComponent";
|
||||
import FrontendToolsComponent from "swaf/components/FrontendToolsComponent";
|
||||
import LogRequestsComponent from "swaf/components/LogRequestsComponent";
|
||||
import MailComponent from "swaf/components/MailComponent";
|
||||
import MaintenanceComponent from "swaf/components/MaintenanceComponent";
|
||||
import MysqlComponent from "swaf/components/MysqlComponent";
|
||||
import PreviousUrlComponent from "swaf/components/PreviousUrlComponent";
|
||||
import RedisComponent from "swaf/components/RedisComponent";
|
||||
import ServeStaticDirectoryComponent from "swaf/components/ServeStaticDirectoryComponent";
|
||||
import MaintenanceComponent from "swaf/components/MaintenanceComponent";
|
||||
import MailComponent from "swaf/components/MailComponent";
|
||||
import SessionComponent from "swaf/components/SessionComponent";
|
||||
import FormHelperComponent from "swaf/components/FormHelperComponent";
|
||||
import CsrfProtectionComponent from "swaf/components/CsrfProtectionComponent";
|
||||
import WebSocketServerComponent from "swaf/components/WebSocketServerComponent";
|
||||
import HomeController from "./controllers/HomeController";
|
||||
import AutoUpdateComponent from "swaf/components/AutoUpdateComponent";
|
||||
import DummyMigration from "swaf/migrations/DummyMigration";
|
||||
import DropLegacyLogsTable from "swaf/migrations/DropLegacyLogsTable";
|
||||
import PreviousUrlComponent from "swaf/components/PreviousUrlComponent";
|
||||
import MailViewEngine from "swaf/frontend/MailViewEngine";
|
||||
import Migration, {MigrationType} from "swaf/db/Migration";
|
||||
import AssetCompiler from "swaf/frontend/AssetCompiler";
|
||||
import FrontendToolsComponent from "swaf/components/FrontendToolsComponent";
|
||||
import CopyAssetPreCompiler from "swaf/frontend/CopyAssetPreCompiler";
|
||||
import ScssAssetPreCompiler from "swaf/frontend/ScssAssetPreCompiler";
|
||||
import TypeScriptPreCompiler from "swaf/frontend/TypeScriptPreCompiler";
|
||||
import SvelteViewEngine from "swaf/frontend/SvelteViewEngine";
|
||||
import MailViewEngine from "swaf/frontend/MailViewEngine";
|
||||
import NunjucksViewEngine from "swaf/frontend/NunjucksViewEngine";
|
||||
import ScssAssetPreCompiler from "swaf/frontend/ScssAssetPreCompiler";
|
||||
import SvelteViewEngine from "swaf/frontend/SvelteViewEngine";
|
||||
import TypeScriptPreCompiler from "swaf/frontend/TypeScriptPreCompiler";
|
||||
import CreateMigrationsTable from "swaf/migrations/CreateMigrationsTable";
|
||||
import DropLegacyLogsTable from "swaf/migrations/DropLegacyLogsTable";
|
||||
import DummyMigration from "swaf/migrations/DummyMigration";
|
||||
|
||||
import HomeController from "./controllers/HomeController.js";
|
||||
|
||||
export default class App extends Application {
|
||||
public constructor(
|
||||
|
|
|
@ -1 +1 @@
|
|||
console.log('common code between back and front');
|
||||
console.log('common code between back and front');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Controller from "swaf/Controller";
|
||||
import {Request, Response} from "express";
|
||||
import {route} from "swaf/common/Routing";
|
||||
import Controller from "swaf/Controller";
|
||||
|
||||
export default class HomeController extends Controller {
|
||||
public routes(): void {
|
||||
|
|
|
@ -6,10 +6,11 @@ process.env['NODE_CONFIG_DIR'] =
|
|||
+ delimiter
|
||||
+ (process.env['NODE_CONFIG_DIR'] || __dirname + '/../config/');
|
||||
|
||||
import {logger} from "swaf/Logger";
|
||||
import App from "./App";
|
||||
import config from "config";
|
||||
import {promises as fs} from "fs";
|
||||
import {logger} from "swaf/Logger";
|
||||
|
||||
import App from "./App.js";
|
||||
|
||||
(async () => {
|
||||
logger.debug('Config path:', process.env['NODE_CONFIG_DIR']);
|
||||
|
|
Loading…
Reference in New Issue