Skip to content

Commit 611b4da

Browse files
SamWilsnPandapip1
andauthored
Add type checking, eslint, and prettier to npm test. (#358)
* Add tsc to npm test * Enable eslint with TypeScript support * Enable and run prettier * Bun test -> bun run test Signed-off-by: Gavin John <[email protected]> * Fix rate limit type error Signed-off-by: Gavin John <[email protected]> * Missed one! Signed-off-by: Gavin John <[email protected]> * Don't use any; reformat * Bump throttling plugin for better types * Update lockfile --------- Signed-off-by: Gavin John <[email protected]> Co-authored-by: Gavin John <[email protected]> Co-authored-by: Gavin John <>
1 parent 99b3762 commit 611b4da

37 files changed

+2594
-1285
lines changed

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
root = true
2+
3+
[*.{js,mjs,cjs,ts,json,html,yaml,yml}]
4+
indent_style = space
5+
indent_size = 4
6+
insert_final_newline = true
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
10+
[*.{yaml,yml}]
11+
indent_size = 2

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
/dist

.eslintrc.cjs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
module.exports = {
2+
extends: [
3+
"eslint:recommended",
4+
"plugin:@typescript-eslint/recommended",
5+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
6+
"plugin:@typescript-eslint/strict",
7+
"prettier",
8+
],
9+
rules: {
10+
"@typescript-eslint/no-unused-vars": [
11+
"warn",
12+
{ argsIgnorePattern: "^_" },
13+
],
14+
},
15+
parser: "@typescript-eslint/parser",
16+
plugins: ["@typescript-eslint"],
17+
root: true,
18+
parserOptions: {
19+
project: true,
20+
},
21+
22+
overrides: [
23+
{
24+
files: ["src/__tests__/**", "src/rules/__tests__/**"],
25+
rules: {
26+
"@typescript-eslint/no-unsafe-assignment": ["off"],
27+
"@typescript-eslint/no-unsafe-call": ["off"],
28+
"@typescript-eslint/no-unsafe-member-access": ["off"],
29+
},
30+
},
31+
],
32+
};

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
deploy:
1010
name: Build and Deploy
1111
runs-on: ubuntu-latest
12-
12+
1313
steps:
1414
- name: Checkout
1515
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ jobs:
3333

3434
- name: Build
3535
run: bun run build
36-
36+
3737
- name: Test
38-
run: bun test
38+
run: bun run test

.github/workflows/codeql-analysis.yml

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ on:
2020
branches:
2121
- main
2222
schedule:
23-
- cron: '0 0 * * 1'
23+
- cron: "0 0 * * 1"
2424

2525
jobs:
2626
analyze:
@@ -34,41 +34,40 @@ jobs:
3434
strategy:
3535
fail-fast: false
3636
matrix:
37-
language: [ 'javascript' ]
37+
language: ["javascript"]
3838
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
3939
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
4040

4141
steps:
42-
- name: Checkout repository
43-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
42+
- name: Checkout repository
43+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
4444

45-
# Initializes the CodeQL tools for scanning.
46-
- name: Initialize CodeQL
47-
uses: github/codeql-action/init@e5f05b81d5b6ff8cfa111c80c22c5fd02a384118 # v3.23.0
48-
with:
49-
languages: ${{ matrix.language }}
50-
# If you wish to specify custom queries, you can do so here or in a config file.
51-
# By default, queries listed here will override any specified in a config file.
52-
# Prefix the list here with "+" to use these queries and those in the config file.
53-
54-
# 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
55-
# queries: security-extended,security-and-quality
45+
# Initializes the CodeQL tools for scanning.
46+
- name: Initialize CodeQL
47+
uses: github/codeql-action/init@407ffafae6a767df3e0230c3df91b6443ae8df75 # v2.22.8
48+
with:
49+
languages: ${{ matrix.language }}
50+
# If you wish to specify custom queries, you can do so here or in a config file.
51+
# By default, queries listed here will override any specified in a config file.
52+
# Prefix the list here with "+" to use these queries and those in the config file.
5653

57-
58-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
59-
# If this step fails, then you should remove it and run the build manually (see below)
60-
- name: Autobuild
61-
uses: github/codeql-action/autobuild@e5f05b81d5b6ff8cfa111c80c22c5fd02a384118 # v3.23.0
54+
# 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
55+
# queries: security-extended,security-and-quality
6256

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

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

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

73-
- name: Perform CodeQL Analysis
74-
uses: github/codeql-action/analyze@e5f05b81d5b6ff8cfa111c80c22c5fd02a384118 # v3.23.0
68+
# - run: |
69+
# echo "Run, Build Application using script"
70+
# ./location_of_script_within_repo/buildscript.sh
71+
72+
- name: Perform CodeQL Analysis
73+
uses: github/codeql-action/analyze@407ffafae6a767df3e0230c3df91b6443ae8df75 # v2.22.8

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/dist
2+
node_modules

.prettierrc.cjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
plugins: ["@trivago/prettier-plugin-sort-imports"],
3+
importOrderSeparation: true,
4+
importOrderSortSpecifiers: true,
5+
};

action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ inputs:
99
config:
1010
description: Config file location
1111
required: false
12-
default: ''
12+
default: ""
1313
pr_number:
1414
description: The PR Number
1515
required: false
16-
default: ''
16+
default: ""
1717

1818
runs:
1919
using: node16

bun.lockb

100644100755
38 KB
Binary file not shown.

0 commit comments

Comments
 (0)