eslint - rules updated
This commit is contained in:
@@ -9,32 +9,38 @@ module.exports = {
|
||||
],
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
"plugin:@typescript-eslint/eslint-recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:promise/recommended",
|
||||
'plugin:@typescript-eslint/eslint-recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:promise/recommended',
|
||||
],
|
||||
rules: {
|
||||
"no-console": "error",
|
||||
"max-len": ["error", {"code": 128}],
|
||||
"no-process-env": "error",
|
||||
"no-process-exit": "error",
|
||||
"no-null/no-null": "error",
|
||||
"no-useless-return": "error",
|
||||
"prefer-arrow-callback": "warn",
|
||||
"object-curly-spacing": "error",
|
||||
"consistent-return": "error",
|
||||
"@typescript-eslint/explicit-function-return-type": [
|
||||
"error", {
|
||||
"allowExpressions": true,
|
||||
'no-console': 'error',
|
||||
'max-len': ['error', {'code': 128}],
|
||||
'no-process-env': 'error',
|
||||
'no-process-exit': 'error',
|
||||
'no-null/no-null': 'error',
|
||||
'no-useless-return': 'error',
|
||||
'prefer-arrow-callback': 'warn',
|
||||
'consistent-return': 'error',
|
||||
'@typescript-eslint/explicit-function-return-type': [
|
||||
'error', {
|
||||
'allowExpressions': true,
|
||||
},
|
||||
],
|
||||
"no-void": "error",
|
||||
"comma-spacing": "error",
|
||||
"comma-dangle": ["error", "always-multiline"],
|
||||
"comma-style": "error",
|
||||
"semi": "error",
|
||||
"no-implicit-coercion": "error",
|
||||
|
||||
"promise/always-return": "off",
|
||||
'no-void': 'error',
|
||||
'comma-spacing': 'error',
|
||||
'comma-dangle': ['error', 'always-multiline'],
|
||||
'comma-style': 'error',
|
||||
'semi': 'error',
|
||||
'no-implicit-coercion': 'error',
|
||||
'quotes': ['error', 'single', 'avoid-escape'],
|
||||
'keyword-spacing': 'error',
|
||||
'semi-spacing': 'error',
|
||||
'arrow-spacing': 'error',
|
||||
'object-curly-spacing': 'error',
|
||||
'array-bracket-spacing': 'error',
|
||||
'key-spacing': 'error',
|
||||
'block-spacing': 'error',
|
||||
'promise/always-return': 'off',
|
||||
},
|
||||
};
|
||||
|
||||
12
src/app.ts
12
src/app.ts
@@ -11,11 +11,11 @@ export const app = express();
|
||||
|
||||
// Permissions
|
||||
PermManager
|
||||
.grant("user")
|
||||
.execute("read").on("userinfo")
|
||||
.grant("coe_bs")
|
||||
.extend("user")
|
||||
.execute("write").on("userinfo");
|
||||
.grant('user')
|
||||
.execute('read').on('userinfo')
|
||||
.grant('coe_bs')
|
||||
.extend('user')
|
||||
.execute('write').on('userinfo');
|
||||
|
||||
// view engine setup
|
||||
app.set('views', path.join(__dirname, '../views'));
|
||||
@@ -44,7 +44,7 @@ router.use(AutoReloader.router);
|
||||
//router.use(Session.getRouter());
|
||||
|
||||
// static config
|
||||
router.use("/js/polyfill.js", Polyfill.getRouter('./public/js/bundle.js'));
|
||||
router.use('/js/polyfill.js', Polyfill.getRouter('./public/js/bundle.js'));
|
||||
router.use(sassMiddleware({
|
||||
src: path.join(__dirname, '../public'),
|
||||
dest: path.join(__dirname, '../public'),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable no-process-exit,no-console */
|
||||
import * as http from "http";
|
||||
import * as http from 'http';
|
||||
import {DefaultConfig, urlJoin} from 'pkg-express-utils';
|
||||
|
||||
const options = {
|
||||
|
||||
@@ -9,9 +9,9 @@ import {DefaultConfig, Logger} from 'pkg-express-utils';
|
||||
app.set('port', DefaultConfig.PORT);
|
||||
const server = http.createServer(app);
|
||||
|
||||
app.listen(DefaultConfig.PORT);
|
||||
server.on('error', onError);
|
||||
server.on('listening', onListening);
|
||||
server.listen(DefaultConfig.PORT);
|
||||
|
||||
function onError(error: HttpError): void {
|
||||
if (error.syscall !== 'listen') {
|
||||
|
||||
@@ -4,7 +4,7 @@ import {PermManager} from 'pkg-express-utils';
|
||||
const userRouter = express.Router();
|
||||
|
||||
/* GET users listing. */
|
||||
userRouter.get('/', PermManager.getRouter("userinfo", {action: "read"}), async (req, res) => {
|
||||
userRouter.get('/', PermManager.getRouter('userinfo', {action: 'read'}), async (req, res) => {
|
||||
res.json(await req.getUserInfo() || {});
|
||||
});
|
||||
|
||||
|
||||
@@ -5,12 +5,12 @@ import healthRouter from './healthcheck';
|
||||
const router = express.Router();
|
||||
export default router;
|
||||
|
||||
router.use("/api/user", userRouter);
|
||||
router.use("/health", healthRouter);
|
||||
router.use('/api/user', userRouter);
|
||||
router.use('/health', healthRouter);
|
||||
|
||||
/* GET home page. */
|
||||
router.get('/', async (req, res) => {
|
||||
const email = (await req.getUserInfo())?.email ?? "No email found!";
|
||||
const email = (await req.getUserInfo())?.email ?? 'No email found!';
|
||||
res.render('index', {title: 'Express', email});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user