Skip to content

Commit

Permalink
chore: apply eslint rules and upgrade node version
Browse files Browse the repository at this point in the history
  • Loading branch information
icfor committed Nov 10, 2023
1 parent 24a1e39 commit 790cafa
Show file tree
Hide file tree
Showing 129 changed files with 1,989 additions and 2,078 deletions.
131 changes: 71 additions & 60 deletions .eslintrc.json → .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,86 +1,97 @@
{
"env": {
"browser": true,
"es2021": true
module.exports = {
env: {
browser: true,
es2021: true,
},
"extends": ["plugin:react/recommended", "airbnb", "prettier"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
extends: ["plugin:react/recommended", "airbnb", "prettier"],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaFeatures: {
jsx: true,
},
"ecmaVersion": "latest",
"sourceType": "module"
ecmaVersion: "latest",
sourceType: "module",
},
"plugins": ["react", "@typescript-eslint", "prettier"],
"rules": {
plugins: ["react", "@typescript-eslint", "prettier"],
rules: {
"arrow-body-style": "error",
"camelcase": "off",
"global-require": "off",
"max-len": "error",
"import/no-extraneous-dependencies": "off",
"import/no-dynamic-require": "error",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-shadow": "error",
"no-shadow": "off",
"no-unused-vars": "off",
"object-shorthand": "error",
"prefer-const": "error",
"quote-props": ["error", "consistent-as-needed"],

"@typescript-eslint/no-shadow": "error",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-var-requires": "off",

"jsx-a11y/alt-text": "off",
"jsx-a11y/anchor-is-valid": "off",
"jsx-a11y/click-events-have-key-events": "off",
"jsx-a11y/interactive-supports-focus": "off",
"jsx-a11y/control-has-associated-label": "off",
"react/no-unknown-property": "off",
"camelcase": "off",
"import/prefer-default-export": "off",
"jsx-a11y/interactive-supports-focus": "off",
"jsx-a11y/no-static-element-interactions": "off",

"import/extensions": [
"error",
"ignorePackages",
{
"js": "never",
"jsx": "never",
"ts": "never",
"tsx": "never"
}
js: "never",
jsx: "never",
ts: "never",
tsx: "never",
},
],
"import/no-absolute-path": "off",
"import/no-dynamic-require": "error",
"import/no-extraneous-dependencies": "off",
"import/no-unresolved": "off",
"arrow-body-style": "off",
"jsx-a11y/no-static-element-interactions": "off",
"react/jsx-props-no-spreading": "off",
"react/react-in-jsx-scope": "off",
"react/jsx-one-expression-per-line": "off",
"jsx-a11y/alt-text": "off",
"react/no-unescaped-entities": "off",
"react/require-default-props": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"import/prefer-default-export": "off",

"react/no-array-index-key": "off",
"import/no-absolute-path": "off",
"global-require": "off",
"react/jsx-filename-extension": [
2,
{
"extensions": [".js", ".jsx", ".ts", ".tsx"]
}
extensions: [".js", ".jsx", ".ts", ".tsx"],
},
],
"react/function-component-definition": "off"

"prefer-template": "error",
"react/function-component-definition": "off",
"react/jsx-boolean-value": "error",
"react/jsx-one-expression-per-line": "off",
"react/jsx-props-no-spreading": "off",
"react/jsx-sort-props": "error",
"react/no-array-index-key": "off",
"react/no-unescaped-entities": "off",
"react/no-unknown-property": "off",
"react/react-in-jsx-scope": "off",
"react/require-default-props": "off",
"react/self-closing-comp": "error",
},
"overrides": [
overrides: [
{
"files": ["tests/**/*"],
"rules": {
"no-undef": "off"
}
files: ["tests/**/*"],
rules: {
"no-undef": "off",
},
},
{
"files": ["src/**/*.test.tsx", "src/**/*.test.ts", "**/*.spec.ts"],
"rules": {
files: ["src/**/*.test.tsx", "src/**/*.test.ts", "**/*.spec.ts"],
rules: {
"no-undef": "off",
"import/no-extraneous-dependencies": "off"
}
}
"import/no-extraneous-dependencies": "off",
},
},
],
"settings": {
settings: {
"import/resolver": {
"typescript": {}, // this loads <rootdir>/tsconfig.json to eslint
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx"]
}
}
}
}
typescript: {}, // this loads <rootdir>/tsconfig.json to eslint
node: {
extensions: [".js", ".jsx", ".ts", ".tsx"],
},
},
},
};
5 changes: 3 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"plugins": ["@trivago/prettier-plugin-sort-imports"],
"importOrder": ["^~(.*)$", "^[./]"],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true
"importOrderSortSpecifiers": true,
"plugins": ["@trivago/prettier-plugin-sort-imports"],
"quoteProps": "consistent"
}
7 changes: 2 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
FROM node:14.15.0-alpine
FROM node:20-alpine

ENV PORT 3000

# Install git for ui and internal packages
RUN apk add --no-cache git

# Set app directory
WORKDIR /app

Expand Down Expand Up @@ -49,4 +46,4 @@ RUN npm run build
EXPOSE ${PORT}

# Running the app
CMD ["pm2-runtime", "dist/index.js"]
CMD ["pm2-runtime", "dist/index.js"]
2 changes: 1 addition & 1 deletion ecosystem.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
script: "dist/index.js",
watch: true,
env: {
"NODE_ENV": "production",
NODE_ENV: "production",
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
"plugins": [
plugins: [
'autoprefixer'
]
}
4 changes: 1 addition & 3 deletions server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,7 @@ const ghostAdminApi = new GhostAdminAPI({
},
);

server.all("*", (req: Request, res: Response) => {
return handle(req, res);
});
server.all("*", (req: Request, res: Response) => handle(req, res));

server.listen(port, (err?: any) => {
if (err) throw err;
Expand Down
Loading

0 comments on commit 790cafa

Please sign in to comment.