Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft - Proposal for code linting #3839

Merged
merged 15 commits into from
Feb 23, 2024
Merged
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
indent_style = tab
tab_width = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ui/core/proto/*
65 changes: 44 additions & 21 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,51 @@
module.exports = {
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
"unused-imports"
root: true,
parser: '@typescript-eslint/parser',
plugins: ['simple-import-sort'],
extends: [
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
"env": {
"browser": true,
"es6": true,
"node": true
env: {
es6: true,
browser: true,
},
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
parserOptions: {
ecmaVersion: 2021,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"rules": {
"@typescript-eslint/no-unused-vars": "off",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"error",
{ "vars": "all", "varsIgnorePattern": "^_", "args": "after-used", "argsIgnorePattern": "^_" }
rules: {
'@typescript-eslint/member-delimiter-style': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/indent': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'@typescript-eslint/no-object-literal-type-assertion': 'off',
'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'prettier/prettier': 'off',
'import/no-unresolved': 'off',
'simple-import-sort/imports': 'warn',
'import/named': 'off',
'import/namespace': 'off',
'arrow-parens': ['error', 'as-needed'],
}
};
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ ui/*/index.html
.dirstamp

# IDE folders
.vscode
.idea
.history

# binaries
dist
binary_dist
sim/web/__debug_bin
/wowsimwotlkcli*
/wowsimwotlk*

# temporary files
*.results.tmp
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18.18.0
14 changes: 14 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* @type {import("prettier").Options)}
*/
module.exports = {
printWidth: 100,
useTabs: true,
tabWidth: 4,
semi: true,
singleQuote: true,
trailingComma: 'all',
bracketSpacing: true,
bracketSameLine: true,
arrowParens: 'avoid',
};
9 changes: 9 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"stylelint.vscode-stylelint",
"visualstudioexptteam.vscodeintellicode",
"editorconfig.editorconfig"
]
}
30 changes: 29 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,32 @@
{
"eslint.validate": ["javascript", "typescript"],
"eslint.nodePath": "./node_modules",
"eslint.workingDirectories": ["."],
"files.associations": {
"*.js": "javascript",
"*.ts": "typescript"
},
"[typescript]": {
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
},
"[javascript]": {
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
},
"[scss]": {
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
},
"[html]": {
"editor.codeActionsOnSave": {
"source.fixAll.eslint": false
}
},
"json.format.enable": true,
"json.schemas": [
{
"fileMatch": [
Expand Down Expand Up @@ -84,4 +112,4 @@
"tinsert",
"UIParent"
]
}
}
40 changes: 17 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
# syntax=docker/dockerfile:1

FROM golang:1.21

WORKDIR /wotlk
COPY . .
COPY gitconfig /etc/gitconfig

RUN apt-get update
RUN apt-get install -y protobuf-compiler
RUN go get -u google.golang.org/protobuf
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@latest

RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash

ENV NODE_VERSION=19.8.0
ENV NVM_DIR="/root/.nvm"
RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION}
ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"

EXPOSE 8080/tcp
# syntax=docker/dockerfile:1
FROM golang:1.21

WORKDIR /wotlk
COPY . .
COPY gitconfig /etc/gitconfig

RUN apt-get update
RUN apt-get install -y protobuf-compiler
RUN go get -u google.golang.org/protobuf
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@latest

ENV NODE_VERSION=18.18.0
kayla-glick marked this conversation as resolved.
Show resolved Hide resolved
ENV PATH="/opt/node-v${NODE_VERSION}-linux-x64/bin:${PATH}"
RUN curl https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.gz |tar xzf - -C /opt/

EXPOSE 8080/tcp
Loading
Loading