Add eslintrc and make the demo work.
parent
27d5050547
commit
40e686bd7a
|
@ -0,0 +1,120 @@
|
|||
{
|
||||
"env": {
|
||||
"es6": true,
|
||||
"amd": true,
|
||||
"browser": true
|
||||
},
|
||||
|
||||
"root": true,
|
||||
"ignorePatterns": ["docs/", "dist/", "out/", "rethinkdb_data/", "node_modules/", "bulmaselect/"],
|
||||
|
||||
"parserOptions": {
|
||||
"sourceType": "module",
|
||||
"ecmaVersion": 2020
|
||||
},
|
||||
|
||||
"extends": ["eslint:recommended"],
|
||||
|
||||
"rules": {
|
||||
"arrow-parens": [1, "always"],
|
||||
"block-spacing": [1, "always"],
|
||||
"brace-style": [1, "1tbs", { "allowSingleLine": true }],
|
||||
"comma-dangle": [1, "always-multiline"],
|
||||
"comma-spacing": [1, { "before": false, "after": true }],
|
||||
"comma-style": [1, "last"],
|
||||
"computed-property-spacing": [1, "never"],
|
||||
"consistent-this": [1, "self"],
|
||||
"eol-last": 1,
|
||||
"eqeqeq": [1, "smart"],
|
||||
"no-inline-comments": 1,
|
||||
"jsx-quotes": [1, "prefer-double"],
|
||||
"lines-around-comment": [1, { "beforeBlockComment": false }],
|
||||
"max-depth": [1, 8],
|
||||
"max-nested-callbacks": [1, 8],
|
||||
"new-parens": 1,
|
||||
"no-array-constructor": 1,
|
||||
"no-lonely-if": 1,
|
||||
"no-mixed-spaces-and-tabs": 1,
|
||||
"no-multiple-empty-lines": 1,
|
||||
"no-new-object": 1,
|
||||
"no-spaced-func": 1,
|
||||
"no-trailing-spaces": 1,
|
||||
"no-return-await": 1,
|
||||
"no-undef": 0,
|
||||
"no-unneeded-ternary": 1,
|
||||
"no-var": 1,
|
||||
"object-curly-spacing": [1, "always"],
|
||||
"operator-linebreak": [1, "after"],
|
||||
"padded-blocks": [1, "never"],
|
||||
"prefer-const": ["error", { "destructuring": "any", "ignoreReadBeforeAssign": false }],
|
||||
"prettier/prettier": 1,
|
||||
"quotes": [1, "double", { "avoidEscape": true, "allowTemplateLiterals": false }],
|
||||
"quote-props": [1, "consistent-as-needed"],
|
||||
"semi": [1, "always"],
|
||||
"semi-spacing": [1, { "before": false, "after": true }],
|
||||
"space-before-blocks": [1, "always"],
|
||||
"space-in-parens": [1, "never"],
|
||||
"space-infix-ops": [1, { "int32Hint": true }],
|
||||
"spaced-comment": [1, "always"],
|
||||
"sort-imports": [
|
||||
"warn",
|
||||
{
|
||||
"ignoreCase": false,
|
||||
"ignoreDeclarationSort": true,
|
||||
"ignoreMemberSort": false,
|
||||
"memberSyntaxSortOrder": ["none", "all", "multiple", "single"],
|
||||
"allowSeparatedGroups": false
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
// Typescript overrides
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["*.ts", "*.tsx"],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"plugins": ["@typescript-eslint"],
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/eslint-recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
],
|
||||
|
||||
// Enable if you need jsx support
|
||||
// "parserOptions": {
|
||||
// "ecmaFeatures": { "jsx": true }
|
||||
// },
|
||||
|
||||
"rules": {
|
||||
"semi": "off",
|
||||
"@typescript-eslint/no-unused-vars": "error",
|
||||
"@typescript-eslint/member-delimiter-style": "error",
|
||||
"@typescript-eslint/member-ordering": "error",
|
||||
"@typescript-eslint/type-annotation-spacing": "error",
|
||||
"@typescript-eslint/semi": [1, "always"],
|
||||
"@typescript-eslint/no-explicit-any": 0,
|
||||
"@typescript-eslint/no-var-requires": 0,
|
||||
"@typescript-eslint/explicit-module-boundary-types": "off",
|
||||
"@typescript-eslint/ban-ts-comment": "off",
|
||||
"@typescript-eslint/no-empty-function": "off",
|
||||
"@typescript-eslint/naming-convention": [
|
||||
"warn",
|
||||
{ "selector": "default", "format": ["camelCase"] },
|
||||
{ "selector": "variableLike", "format": ["camelCase"] },
|
||||
{ "selector": "variable", "format": ["camelCase", "UPPER_CASE", "PascalCase"] },
|
||||
{ "selector": "parameter", "format": ["camelCase"], "leadingUnderscore": "allow" },
|
||||
{ "selector": "memberLike", "format": ["camelCase"] },
|
||||
{ "selector": "memberLike", "modifiers": ["private"], "format": ["camelCase"], "leadingUnderscore": "require" },
|
||||
{ "selector": "typeLike", "format": null },
|
||||
{ "selector": "typeAlias", "format": null },
|
||||
{ "selector": "typeProperty", "format": null },
|
||||
{ "selector": "typeParameter", "format": ["PascalCase"], "prefix": ["T"] },
|
||||
{ "selector": "interface", "format": ["PascalCase"], "custom": { "regex": "^I[A-Z]", "match": false } },
|
||||
{ "selector": "objectLiteralProperty", "format": null },
|
||||
{ "selector": "enumMember", "format": ["UPPER_CASE"] }
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -18,8 +18,10 @@ const indexRateLimit = rateLimit({
|
|||
export function indexRoutes() {
|
||||
// Index
|
||||
router.get("/", indexRateLimit,async (req,res) => {
|
||||
const todos = ['fork and clone', 'make it better', 'make a pull request']
|
||||
res.render("index", {
|
||||
//locales: getWebLocale(bot, locale),
|
||||
todos: todos,
|
||||
page: req.url,
|
||||
//user: user,
|
||||
});
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -26,11 +26,13 @@
|
|||
"typescript": "^4.8.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^5.40.1",
|
||||
"express": "^4.18.2",
|
||||
"express-rate-limit": "^6.6.0",
|
||||
"express-session": "^1.17.3",
|
||||
"liquidjs": "^9.42.0",
|
||||
"path": "^0.12.7",
|
||||
"prettier": "^2.7.1",
|
||||
"terser": "^5.15.1"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue