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/*
66 changes: 45 additions & 21 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,52 @@
module.exports = {
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
"unused-imports"
root: true,
parser: '@typescript-eslint/parser',
plugins: ['simple-import-sort'],
extends: [
'plugin:json/recommended',
'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 @@
19.8.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"
]
}
48 changes: 45 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,47 @@
{
"eslint.validate": ["javascript", "typescript"],
"eslint.nodePath": "./node_modules",
"eslint.workingDirectories": ["."],
"files.associations": {
"*.js": "javascript",
"*.ts": "typescript"
},
"[typescript]": {
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "always"
}
},
"[javascript]": {
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "always"
}
},
"[scss]": {
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "always"
}
},
"[html]": {
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "always"
}
},
"[json]": {
"editor.formatOnSave": true,
},
"json.format.enable": true,
"json.schemas": [
{
"fileMatch": [
"*.apl.json"
],
"url": "./jsonschema/APLRotation.json"
"url": "./schemas/apl_rotation.schema.json"
},
{
"fileMatch": [
"*.gear.json"
],
"url": "./schemas/gear.schema.json"
}
],
"Lua.diagnostics.globals": [
Expand Down Expand Up @@ -83,5 +120,10 @@
"strbyte",
"tinsert",
"UIParent"
]
}
],
"[javascript][scss][typescript]": {
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
}
}
46 changes: 23 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# 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

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
Loading
Loading