diff --git a/.editorconfig b/.editorconfig index 0689ead91..136378e0b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,6 +1,6 @@ # EditorConfig is awesome: https://EditorConfig.org -# Stop the editor from looking for ".editorconfig" files in the parent directories. +# Stop editor looking for ".editorconfig" in parent directories. root = true [*] @@ -9,7 +9,7 @@ root = true charset = utf-8 insert_final_newline = true -# Caveat: Prettier won’t trim trailing whitespace inside template strings, +# Caveat: Prettier won’t trim whitespace inside template strings, # but your editor might. trim_trailing_whitespace = true diff --git a/.github/linters/.eslintrc.yml b/.github/linters/.eslintrc.yml new file mode 100644 index 000000000..7495d3e0a --- /dev/null +++ b/.github/linters/.eslintrc.yml @@ -0,0 +1,78 @@ +--- +############################# +############################# +## JavaScript Linter rules ## +############################# +############################# + +############ +# Env Vars # +############ +env: + browser: true + es6: true + jest: true + +############### +# Global Vars # +############### +globals: + Atomics: readonly + SharedArrayBuffer: readonly + +ignorePatterns: + - "!.*" + - "**/node_modules/.*" + +############### +# Parser vars # +############### +parser: '@typescript-eslint/parser' +parserOptions: + ecmaVersion: 2018 + sourceType: module + +########### +# Plugins # +########### +plugins: + - '@typescript-eslint' + +######### +# Rules # +######### +rules: { + eqeqeq: ["error", "smart"] +} + +############################## +# Overrides for JSON parsing # +############################## +overrides: + + # JSON files + - files: + - "*.json" + extends: + - plugin:jsonc/recommended-with-json + parser: jsonc-eslint-parser + parserOptions: + jsonSyntax: JSON + + # JSONC files + - files: + - "*.jsonc" + extends: + - plugin:jsonc/recommended-with-jsonc + parser: jsonc-eslint-parser + parserOptions: + jsonSyntax: JSONC + + # JSON5 files + - files: + - "*.json5" + extends: + - plugin:jsonc/recommended-with-json5 + parser: jsonc-eslint-parser + parserOptions: + jsonSyntax: JSON5 diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 000000000..9c9308d1d --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,66 @@ +--- +################################# +################################# +## Super Linter GitHub Actions ## +################################# +################################# +name: Lint Code Base + +# +# Documentation: +# https://docs.github.com/en/actions/learn-github-actions/ +# workflow-syntax-for-github-actions +# + +############################# +# Start the job on all push # +############################# +on: + push: + branches-ignore: [master, main] + # Remove the line above to run when pushing to master + pull_request: + branches: [master, main] + +############### +# Set the Job # +############### +jobs: + build: + # Name the Job + name: Lint Code Base + # Set the agent to run on + runs-on: ubuntu-latest + + ############################################ + # Grant status permission for MULTI_STATUS # + ############################################ + permissions: + contents: read + packages: read + statuses: write + + ################## + # Load all steps # + ################## + steps: + ########################## + # Checkout the code base # + ########################## + - name: Checkout Code + uses: actions/checkout@v3 + with: + # Full git history is needed to get a proper + # list of changed files within `super-linter` + fetch-depth: 0 + + ################################ + # Run Linter against code base # + ################################ + - name: Lint Code Base + uses: super-linter/super-linter@v5 + env: + VALIDATE_ALL_CODEBASE: false + # Change to 'master' if your main branch differs + DEFAULT_BRANCH: master + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}