Skip to content

Commit

Permalink
Merge pull request #72 from translate-tools/use-vitest-for-tests
Browse files Browse the repository at this point in the history
Use vitest for tests
  • Loading branch information
vitonsky authored Dec 23, 2024
2 parents 9272186 + 8c9ddcd commit bf73d7c
Show file tree
Hide file tree
Showing 7 changed files with 5,410 additions and 7,611 deletions.
81 changes: 66 additions & 15 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
"ecmaVersion": 11,
"sourceType": "module"
},
"plugins": ["@typescript-eslint", "unused-imports", "simple-import-sort"],
"plugins": [
"@typescript-eslint",
"unused-imports",
"simple-import-sort"
],
"extends": [
"plugin:import/recommended",
"plugin:import/errors",
Expand All @@ -25,36 +29,75 @@
"noUselessIndex": true
}
],
"import/no-unresolved": [
"error",
{
"ignore": [
"^vitest/config"
]
}
],
"import/export": "off",
"import/namespace": "warn",
"import/no-duplicates": ["error", { "prefer-inline": true }],
"import/newline-after-import": ["error", { "count": 1 }],
"import/no-duplicates": [
"error",
{
"prefer-inline": true
}
],
"import/newline-after-import": [
"error",
{
"count": 1
}
],
"unused-imports/no-unused-imports": "error",
"simple-import-sort/imports": [
"error",
{
// docs: https://github.com/lydell/eslint-plugin-simple-import-sort#custom-grouping
"groups": [
// Side effect imports.
["^\\u0000"],
[
"^\\u0000"
],
// Node.js builtins prefixed with `node:`.
["^node:"],
[
"^node:"
],
// Packages.
// Things that start with a letter (or digit or underscore), or `@` followed by a letter.
["^react", "^\\w", "^@\\w"],
[
"^react",
"^\\w",
"^@\\w"
],
// Absolute imports and other imports such as Vue-style `@/foo`.
// Anything not matched in another group.
["^"],
[
"^"
],
// Relative imports.
["^../../"],
[
"^../../"
],
// Anything that starts with a dot.
["^../", "^./", "^\\."],
[
"^../",
"^./",
"^\\."
],
// Global CSS files at bottom
["\\.css$"]
[
"\\.css$"
]
]
}
],
"function-call-argument-newline": ["error", "consistent"],
"function-call-argument-newline": [
"error",
"consistent"
],
"no-var": "error",
"no-bitwise": "error",
"no-multi-spaces": "error",
Expand All @@ -64,7 +107,9 @@
"prefer-const": "error",
// off cuz eslint is dumb: https://stackoverflow.com/questions/63818415/react-was-used-before-it-was-defined
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": ["error"],
"@typescript-eslint/no-use-before-define": [
"error"
],
// Codestyle
"indent": [
"error",
Expand All @@ -76,10 +121,16 @@
"camelcase": [
"error",
{
"allow": ["^UNSAFE_", "^UNSTABLE_"]
"allow": [
"^UNSAFE_",
"^UNSTABLE_"
]
}
],
"arrow-parens": ["error", "always"],
"arrow-parens": [
"error",
"always"
],
"operator-linebreak": [
"error",
"after",
Expand All @@ -99,4 +150,4 @@
}
]
}
}
}
60 changes: 30 additions & 30 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ name: "CodeQL"

on:
push:
branches: [ master ]
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
branches: [master]
schedule:
# At 04:35 AM, every 3 days
# test expression on https://crontab.cronhub.io/
- cron: '35 4 */3 * *'
- cron: "35 4 */3 * *"

workflow_dispatch:

Expand All @@ -28,7 +28,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
node-version: "22"

- name: Install deps
run: npm install
Expand All @@ -47,40 +47,40 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript', 'TypeScript' ]
language: ["javascript", "TypeScript"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
Loading

0 comments on commit bf73d7c

Please sign in to comment.