Skip to content

Commit b995a9a

Browse files
committed
use standard-ish minimal settings for eslint, prettier ...
bracketSpacing should also be changed
1 parent 21a34ff commit b995a9a

File tree

8 files changed

+243
-2369
lines changed

8 files changed

+243
-2369
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ name: "CodeQL"
1313

1414
on:
1515
push:
16-
branches: [ "main" ]
16+
branches: ["main"]
1717
pull_request:
1818
# The branches below must be a subset of the branches above
19-
branches: [ "main" ]
19+
branches: ["main"]
2020
schedule:
21-
- cron: '44 16 * * 4'
21+
- cron: "44 16 * * 4"
2222

2323
jobs:
2424
analyze:
@@ -32,41 +32,40 @@ jobs:
3232
strategy:
3333
fail-fast: false
3434
matrix:
35-
language: [ 'javascript' ]
35+
language: ["javascript"]
3636
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
3737
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
3838

3939
steps:
40-
- name: Checkout repository
41-
uses: actions/checkout@v3
40+
- name: Checkout repository
41+
uses: actions/checkout@v3
4242

43-
# Initializes the CodeQL tools for scanning.
44-
- name: Initialize CodeQL
45-
uses: github/codeql-action/init@v2
46-
with:
47-
languages: ${{ matrix.language }}
48-
# If you wish to specify custom queries, you can do so here or in a config file.
49-
# By default, queries listed here will override any specified in a config file.
50-
# Prefix the list here with "+" to use these queries and those in the config file.
51-
52-
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53-
# queries: security-extended,security-and-quality
43+
# Initializes the CodeQL tools for scanning.
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@v2
46+
with:
47+
languages: ${{ matrix.language }}
48+
# If you wish to specify custom queries, you can do so here or in a config file.
49+
# By default, queries listed here will override any specified in a config file.
50+
# Prefix the list here with "+" to use these queries and those in the config file.
5451

55-
56-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
57-
# If this step fails, then you should remove it and run the build manually (see below)
58-
- name: Autobuild
59-
uses: github/codeql-action/autobuild@v2
52+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53+
# queries: security-extended,security-and-quality
6054

61-
# ℹ️ Command-line programs to run using the OS shell.
62-
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
55+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
56+
# If this step fails, then you should remove it and run the build manually (see below)
57+
- name: Autobuild
58+
uses: github/codeql-action/autobuild@v2
6359

64-
# If the Autobuild fails above, remove it and uncomment the following three lines.
65-
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
60+
# ℹ️ Command-line programs to run using the OS shell.
61+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
6662

67-
# - run: |
68-
# echo "Run, Build Application using script"
69-
# ./location_of_script_within_repo/buildscript.sh
63+
# If the Autobuild fails above, remove it and uncomment the following three lines.
64+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
7065

71-
- name: Perform CodeQL Analysis
72-
uses: github/codeql-action/analyze@v2
66+
# - run: |
67+
# echo "Run, Build Application using script"
68+
# ./location_of_script_within_repo/buildscript.sh
69+
70+
- name: Perform CodeQL Analysis
71+
uses: github/codeql-action/analyze@v2

.prettierignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
dist
2+
node_modules
3+
src-tauri
4+
src-wasm
5+
src-common
6+
public
7+
samples
8+
target
9+
10+
package-lock.json
11+
Cargo.lock
12+
13+
*.md
14+
*.toml
15+
*.log
16+
*.wasm
17+
*.woff
18+
*.woff2

.prettierrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"printWidth": 100,
3+
"bracketSpacing": false
4+
}

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"[html]": {
3434
"editor.defaultFormatter": "esbenp.prettier-vscode"
3535
},
36+
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
3637
"search.exclude": {
3738
".git": true,
3839
"target": true,
@@ -42,5 +43,5 @@
4243
"Cargo.lock": true,
4344
"*.{css,sass,scss}.d.ts": true
4445
},
45-
"editor.formatOnSave": true,
46+
"editor.formatOnSave": true
4647
}

eslint.config.js

Lines changed: 23 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,35 @@
11
import js from "@eslint/js";
2-
import tseslint from "@typescript-eslint/eslint-plugin";
3-
import tsparser from "@typescript-eslint/parser";
4-
import react from "eslint-plugin-react";
2+
import globals from "globals";
53
import reactHooks from "eslint-plugin-react-hooks";
6-
import jsxA11y from "eslint-plugin-jsx-a11y";
7-
import promise from "eslint-plugin-promise";
4+
import reactRefresh from "eslint-plugin-react-refresh";
5+
import tseslint from "typescript-eslint";
6+
import prettier from "eslint-config-prettier";
87

9-
export default [
10-
js.configs.recommended,
8+
export default tseslint.config(
9+
{ignores: ["dist", "node_modules", "src-tauri", "src-wasm", "public", "samples", "target"]},
1110
{
12-
ignores: [
13-
// Dependencies
14-
"node_modules/**",
15-
"package-lock.json",
16-
// Build outputs
17-
"dist/**",
18-
"target/**",
19-
"src-wasm/pkg/**",
20-
// Generated files
21-
"**/*.scss.d.ts",
22-
"**/*.d.ts",
23-
"!src/**/*.d.ts",
24-
// Sample/test files
25-
"samples/**",
26-
"public/**",
27-
// Rust source files
28-
"**/*.rs",
29-
"src-tauri/**",
30-
"src-wasm/**",
31-
// Config files
32-
"Cargo.toml",
33-
"Cargo.lock",
34-
// Logs
35-
"**/*.log",
36-
"log.txt",
37-
// Other
38-
"README.md",
39-
"index.html",
40-
".gitignore",
41-
],
42-
},
43-
{
44-
files: ["**/*.{js,jsx,ts,tsx}"],
11+
extends: [js.configs.recommended, ...tseslint.configs.recommended],
12+
files: ["**/*.{ts,tsx,js,jsx}"],
4513
languageOptions: {
46-
parser: tsparser,
47-
parserOptions: {
48-
ecmaVersion: "latest",
49-
sourceType: "module",
50-
ecmaFeatures: {
51-
jsx: true,
52-
},
53-
},
54-
globals: {
55-
window: "readonly",
56-
document: "readonly",
57-
console: "readonly",
58-
process: "readonly",
59-
},
14+
ecmaVersion: 2020,
15+
globals: globals.browser,
6016
},
6117
plugins: {
62-
"@typescript-eslint": tseslint,
63-
react: react,
6418
"react-hooks": reactHooks,
65-
"jsx-a11y": jsxA11y,
66-
promise: promise,
19+
"react-refresh": reactRefresh,
6720
},
6821
rules: {
69-
"react-hooks/rules-of-hooks": "error",
70-
"react/react-in-jsx-scope": "off",
71-
"react/jsx-filename-extension": "off",
72-
// "import/extensions": "off",
73-
// "import/no-unresolved": "off",
74-
// "import/no-import-module-exports": "off",
75-
"no-undef": "off",
76-
"no-shadow": "off",
77-
"@typescript-eslint/no-shadow": "error",
78-
"no-unused-vars": "off",
79-
"react-hooks/exhaustive-deps": "warn",
80-
"react/prop-types": "warn",
81-
"react/require-default-props": "off",
82-
"no-alert": "warn",
83-
"no-restricted-syntax": "warn",
84-
"no-restricted-exports": 0,
85-
"jsx-a11y/click-events-have-key-events": "warn",
86-
"jsx-a11y/no-static-element-interactions": "warn",
87-
"jsx-a11y/label-has-associated-control": [2, {labelAttributes: ["htmlFor"]}],
88-
"jsx-a11y/control-has-associated-label": "warn",
89-
"promise/always-return": "off",
90-
"@typescript-eslint/no-unused-vars": ["warn", {argsIgnorePattern: "^_"}],
91-
},
92-
settings: {
93-
react: {
94-
version: "detect",
95-
},
22+
...reactHooks.configs.recommended.rules,
23+
"react-refresh/only-export-components": ["warn", {allowConstantExport: true}],
24+
"@typescript-eslint/no-unused-vars": [
25+
"warn",
26+
{
27+
argsIgnorePattern: "^_",
28+
varsIgnorePattern: "^_",
29+
caughtErrorsIgnorePattern: "^_",
30+
},
31+
],
9632
},
9733
},
98-
];
34+
prettier,
35+
);

0 commit comments

Comments
 (0)