Skip to content

Commit

Permalink
v0.8.0 QuantumTTT "vs AI" mode (#216)
Browse files Browse the repository at this point in the history
* add aria-label to buttons have no text contents (#205)

* build(deps-dev): bump vite from 5.1.6 to 5.1.7 (#208)

Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.1.6 to 5.1.7.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v5.1.7/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.1.7/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* [Snyk] Upgrade typescript from 5.3.3 to 5.4.2 (#207)

* fix: upgrade typescript from 5.3.3 to 5.4.2

Snyk has created this PR to upgrade typescript from 5.3.3 to 5.4.2.

See this package in npm:
https://www.npmjs.com/package/typescript

See this project in Snyk:
https://app.snyk.io/org/u-sho/project/56523540-5a4b-485d-ae86-4b4f9b0ef853?utm_source=github&utm_medium=referral&page=upgrade-pr

* fetch packge-lock.json

---------

Co-authored-by: snyk-bot <[email protected]>

* Migrate to ESLint Flat Config & [Snyk] Security upgrade eslint from 8.56.0 to 8.57.0 (#210)

* fix: package.json to reduce vulnerabilities

The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-INFLIGHT-6095116

* update typescript-eslint to v7
- `@typescript-eslint/recommended` is included in `@typescript-eslint/strict`
- `svelte/all` helps us
- almost of all browsers can parse es2023

* audit fix

* remove VSCode tabSize setting to take the advantage of tab indentation

* don't use ESLint `--cache` option

Typed lint rules almost always have dependencies on types across files in practice. https://typescript-eslint.io/troubleshooting/#can-i-use-eslints---cache-with-typescript-eslint

* update linter, typechecker, and formatter

* migrate: to ESLint Flat Config
- https://eslint.org/docs/v8.x/use/configure/migration-guide
- https://typescript-eslint.io/blog/announcing-typescript-eslint-v7/#new-features---flat-config-support
- https://sveltejs.github.io/eslint-plugin-svelte/user-guide/#new-config-eslint-config-js
- https://zenn.dev/babel/articles/eslint-flat-config-for-babel#flat-config-への移行-tips

* add ESLint option reporting unused disable directives

---------

Co-authored-by: snyk-bot <[email protected]>

* update build tools (#211)

* update build tools

* update GitHub Action
- changed version of node runtime to node20

* ignore vite temp file for 'npm run ci' command

* fix: add ignores to all eslint configs

* no need to update npm to the latest

* fix: ESLint Flat Config ignores property (#212)

The `ignores` property basically applies to all. However, when user specifies the `files`, it's not

* Refactor: remove dirty hacks from ESLint Flat Config (#213)

* remove duplicated/unused ignores

* remove dirty hack

now, does not depend on internal implementation of typescript-eslint

* use a path that makes it easy to see that it's within the same directory

* update minor dependencies include typescript-eslint

* update eslint.config.js

https://zenn.dev/u_sho/articles/eslint-flat-config-with-svelte-and-typescript

* Fix: ESLint does not use `lib` from `node_modules/@typescript/` (#214)

* fix to load `lib` from node_modules

feature since TypeScript 4.5

* drop support node<20.12

* update dependencies
pin vitest version, cuz typecheck is experimental

* share tsconfig.json options with eslint

* ✨Feature: QuantumTTT vs AI mode (#215)

* (wip) feature: add AI対戦

AIのターン中にクリックされるとバグる

* fix bug: block player click when AI thinking

* fix bug: block player click when AI resolving collapse

* fix: ESLint error

* shorten test time of sleep

* add "vs AI page" to sitemap

* v0.8.0 QuantumTTT 'vs AI' mode

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: snyk-bot <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored May 3, 2024
1 parent 99d1761 commit e9a2926
Show file tree
Hide file tree
Showing 25 changed files with 1,172 additions and 699 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/lintcheck-and-test.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Lint Check & Test
on: [pull_request_review]
on: [pull_request]
jobs:
lint:
runs-on: ${{ matrix.os }}
Expand All @@ -10,13 +10,11 @@ jobs:
- macos-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.node-version'
cache: 'npm'
- name: upgrade npm
run: npm i -g npm@latest

- name: Install Dependencies
run: npm ci
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/snyk-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/node@master
continue-on-error: true
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.8.1
20.12
8 changes: 6 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"editor.insertSpaces": false,
"editor.renderControlCharacters": true,
"editor.renderWhitespace": "boundary",
"editor.tabSize": 2,
"editor.trimAutoWhitespace": true,
"files.eol": "\n",
"files.insertFinalNewline": true,
Expand Down Expand Up @@ -32,5 +31,10 @@
"editor.defaultFormatter": "svelte.svelte-vscode"
},
/* TypeScript */
"typescript.tsdk": "node_modules/typescript/lib"
"typescript.tsdk": "node_modules/typescript/lib",
/* YAML */
"[yaml]": {
"editor.insertSpaces": true,
"editor.tabSize": 2
}
}
193 changes: 107 additions & 86 deletions .eslintrc.cjs → eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,66 +1,57 @@
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
import eslintJs from '@eslint/js';
import tsEslint from 'typescript-eslint';
import sveltePlugin from 'eslint-plugin-svelte';
import svelteParser from 'svelte-eslint-parser';
import prettierConfig from 'eslint-config-prettier';
import globals from 'globals';

const isProduction = () => process.env.NODE_ENV === 'production';

/**
* @type {import('eslint').Linter.Config}
*/
module.exports = {
root: true,
ignorePatterns: [
'.git/**',
'.svelte-kit/**',
'.vercel/**',
'.vercel_build_output/**',
'static/**',
'build/**',
'coverage/**',
'node_modules/**'
],
parser: '@typescript-eslint/parser',
/** @type {import('@typescript-eslint/utils').TSESLint.FlatConfig.FileSpec[]}*/
const ignores = [
'.svelte-kit/',
'.vercel/', // adapter-vercel output dir
'.vercel_build_output/', // old output dir
'static/',
'build/',
'coverage/', // vitest coverage
'node_modules/',
'vite.config.ts.timestamp*' // vite temp file
];

/** @type {import('typescript-eslint').Config} */
const commonConfig = [
{ ignores },
{
linterOptions: {
reportUnusedDisableDirectives: true
}
}
];

const defaultConfig = tsEslint.config({
files: ['**/*.js', '**/*.ts', '**/*.svelte'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended-type-checked',
'plugin:@typescript-eslint/stylistic-type-checked',
'plugin:@typescript-eslint/strict-type-checked',
'plugin:svelte/recommended',
'plugin:svelte/prettier',
'prettier'
eslintJs.configs.recommended,
...tsEslint.configs.strictTypeChecked,
...tsEslint.configs.stylisticTypeChecked,
prettierConfig
],
plugins: ['@typescript-eslint'],
overrides: [
{
files: ['*.svelte'],
parser: 'svelte-eslint-parser',
parserOptions: { parser: '@typescript-eslint/parser' },
rules: {
'no-trailing-spaces': 'off',
'svelte/no-trailing-spaces': ['warn', { skipBlankLines: false, ignoreComments: false }]
}
},
{
files: ['*.svg.svelte'],
rules: { 'svelte/require-optimized-style-attribute': 'off' }
},
{
files: ['*.test.ts'],
rules: {
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-unused-vars': 'off'
}
languageOptions: {
parser: tsEslint.parser,
parserOptions: {
sourceType: 'module',
ecmaVersion: 2023,
project: './tsconfig.eslint.json',
tsconfigRootDir: import.meta.dirname,
extraFileExtensions: ['.svelte']
},
{
files: ['*.js', '*.cjs'],
rules: { '@typescript-eslint/explicit-function-return-type': 'off' }
},
{
files: ['*.cjs'],
rules: { '@typescript-eslint/no-require-imports': 'off' }
},
{
files: ['./*.config.*', '.eslintrc.cjs'],
rules: { '@typescript-eslint/naming-convention': 'off' }
globals: {
...globals.browser,
...globals.es2021,
...globals.node
}
],
},
rules: {
'no-console': isProduction() ? 'error' : 'off',

Expand All @@ -71,20 +62,10 @@ module.exports = {
'no-var': 'error',
'prefer-const': 'error',

// use '$lib/*' instead
'no-restricted-imports': ['error', { patterns: ['../*', 'src/lib/*'] }],

'svelte/no-dupe-on-directives': 'error',
'svelte/no-dupe-use-directives': 'error',
'svelte/no-reactive-reassign': ['error', { props: true }],
'svelte/no-target-blank': 'error',
'svelte/no-immutable-reactive-statements': 'error',
'svelte/no-inline-styles': 'off',
'svelte/no-unused-class-name': 'warn',
'svelte/no-useless-mustaches': 'warn',
'svelte/require-each-key': 'error',
'svelte/require-optimized-style-attribute': 'warn',
'svelte/valid-each-key': 'error',
'no-restricted-imports': [
'error',
{ patterns: [{ group: ['../*', 'src/lib/*'], message: 'use `$lib/*` instead' }] }
],

'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
Expand Down Expand Up @@ -167,25 +148,65 @@ module.exports = {
'@typescript-eslint/prefer-readonly': 'error',
// '@typescript-eslint/prefer-readonly-parameter-types': 'error',
'@typescript-eslint/prefer-regexp-exec': 'error',
'@typescript-eslint/prefer-string-starts-ends-with': [
'error',
{ allowSingleElementEquality: 'always' }
],
'@typescript-eslint/promise-function-async': 'error',
'@typescript-eslint/require-array-sort-compare': 'error',
'@typescript-eslint/restrict-template-expressions': ['error', { allowNumber: true }],
'@typescript-eslint/switch-exhaustiveness-check': 'error',

'@typescript-eslint/non-nullable-type-assertion-style': 'off',
'@typescript-eslint/unbound-method': 'off'
},
settings: {
svelte: { kit: { files: { routes: 'src/routes' } } }
},
parserOptions: {
sourceType: 'module',
ecmaVersion: 'latest',
project: './tsconfig.eslint.json',
extraFileExtensions: ['.svelte']
'@typescript-eslint/non-nullable-type-assertion-style': 'off'
}
});

const svelteConfig = tsEslint.config({
files: ['**/*.svelte'],
extends: [...sveltePlugin.configs['flat/all'], ...sveltePlugin.configs['flat/prettier']],
languageOptions: {
parser: svelteParser,
parserOptions: {
parser: tsEslint.parser
}
},
env: {
browser: true,
es2022: true,
node: true
/** @type {import('eslint').Linter.RulesRecord} */
rules: {
'svelte/no-reactive-reassign': ['error', { props: true }],
'svelte/block-lang': ['error', { script: 'ts', style: 'scss' }],
'svelte/no-inline-styles': 'off',
'svelte/no-unused-class-name': 'warn',
'svelte/no-useless-mustaches': 'warn',
'svelte/no-restricted-html-elements': 'off',
'svelte/require-optimized-style-attribute': 'warn',
'svelte/sort-attributes': 'off',
'svelte/experimental-require-slot-types': 'off',
'svelte/experimental-require-strict-events': 'off',
'no-trailing-spaces': 'off',
'svelte/no-trailing-spaces': ['warn', { skipBlankLines: false, ignoreComments: false }]
}
});

/** @type {import('eslint').Linter.FlatConfig}*/
const svelteSvgConfig = {
files: ['**/*.svg.svelte'],
rules: { 'svelte/require-optimized-style-attribute': 'off' }
};

/** @type {import('@typescript-eslint/utils').TSESLint.FlatConfig.Config}*/
const anyConfigConfig = {
files: ['**/*.config.*'],
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/naming-convention': 'off'
}
};

/** @type {import('typescript-eslint').Config} */
export default [
...defaultConfig,
...svelteConfig,
svelteSvgConfig,
anyConfigConfig,
...commonConfig
];
Loading

0 comments on commit e9a2926

Please sign in to comment.