Skip to content

Commit

Permalink
Merge pull request #1266 from shikorism/develop
Browse files Browse the repository at this point in the history
Release 2024.8.3
  • Loading branch information
shibafu528 authored Aug 24, 2024
2 parents f50f953 + 2eabce4 commit 1f4cc81
Show file tree
Hide file tree
Showing 16 changed files with 1,059 additions and 708 deletions.
10 changes: 8 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,22 @@ jobs:
- store_test_results:
path: /tmp/php-cs-fixer

# Run tsc
- run:
name: tsc
command: yarn run lint:tsc
when: always

# Run stylelint
- run:
name: stylelint
command: yarn run stylelint
command: yarn run lint:stylelint
when: always

# Run eslint
- run:
name: eslint
command: yarn run eslint
command: yarn run lint:eslint
when: always

# Run unit test
Expand Down
36 changes: 0 additions & 36 deletions .eslintrc.cjs

This file was deleted.

2 changes: 1 addition & 1 deletion app/MetadataResolver/MelonbooksResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function resolve(string $url): Metadata
}

// 抽出
preg_match('~^(.+)((.+)の通販・購入はメロンブックス~', $metadata->title, $match);
preg_match('~^(.+)\((.+)\)の通販・購入はメロンブックス~', $metadata->title, $match);
$title = $match[1];
$maker = $match[2];

Expand Down
44 changes: 44 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import js from '@eslint/js';
import ts from 'typescript-eslint';
import globals from 'globals';
import prettierRecommended from 'eslint-plugin-prettier/recommended';
import jquery from 'eslint-plugin-jquery';

export default [
js.configs.recommended,
...ts.configs.recommended,
prettierRecommended,
{
files: ['**/*.js', '**/*.ts', '**/*.tsx'],
plugins: {
jquery,
},
languageOptions: {
sourceType: 'module',
ecmaVersion: 11,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
globals: {
...globals.browser,
...globals.es2020,
...globals.node,
},
},
rules: {
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'jquery/no-ajax': 2,
'jquery/no-ajax-events': 2,
'react/prop-types': 0,
},
settings: {
react: {
version: 'detect',
},
},
},
];
16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
"dev": "vite",
"build": "vite build",
"prod": "npm run build",
"eslint": "eslint --ext .js,.ts,.tsx resources/",
"stylelint": "stylelint resources/assets/sass/**/*",
"lint": "run-s lint:*",
"lint:tsc": "tsc --noEmit",
"lint:eslint": "eslint resources/",
"lint:stylelint": "stylelint resources/assets/sass/**/*",
"doc": "redocly build-docs -o public/apidoc.html openapi.yaml",
"doc-watch": "chokidar openapi.yaml --initial -c \"npm run doc\"",
"prepare": "husky"
},
"devDependencies": {
"@eslint/js": "^9.9.0",
"@redocly/cli": "^1.19.0",
"@tabler/icons-webfont": "^3.6.0",
"@tanstack/react-query": "^4.0.0",
Expand All @@ -25,8 +28,6 @@
"@types/qs": "^6.9.15",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^5.28.0",
"@typescript-eslint/parser": "^5.30.7",
"@vitejs/plugin-react": "^4.3.1",
"bootstrap": "^4.5.0",
"cal-heatmap": "^4.2.4",
Expand All @@ -35,16 +36,18 @@
"classnames": "^2.5.1",
"clipboard": "^2.0.11",
"date-fns": "^2.28.0",
"eslint": "^8.3.0",
"eslint": "^9.9.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jquery": "^1.5.1",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.35.0",
"globals": "^15.9.0",
"husky": "^9.1.4",
"jquery": "^3.7.1",
"js-cookie": "^3.0.5",
"laravel-vite-plugin": "^1.0.5",
"lint-staged": "^10.5.3",
"npm-run-all2": "^6.2.2",
"popper.js": "^1.14.7",
"postcss": "^8.4.41",
"postcss-scss": "^4.0.9",
Expand All @@ -58,7 +61,8 @@
"sass": "^1.77.8",
"stylelint": "^14.16.1",
"stylelint-config-recess-order": "^3.1.0",
"typescript": "^4.7.2",
"typescript": "^5.5.4",
"typescript-eslint": "^8.1.0",
"vite": "^5.3.5"
},
"stylelint": {
Expand Down
4 changes: 2 additions & 2 deletions resources/assets/js/components/TagInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const TagInput: React.FC<TagInputProps> = ({ id, name, values, isInvalid,
const containerClass = classNames('form-control', 'h-auto', { 'is-invalid': isInvalid });
const inputRef = useRef<HTMLInputElement>(null);
const removeTag = (index: number) => {
onChange && onChange(values.filter((v, i) => i != index));
onChange?.(values.filter((v, i) => i != index));
};
const onKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {
if (buffer.trim() !== '') {
Expand Down Expand Up @@ -46,7 +46,7 @@ export const TagInput: React.FC<TagInputProps> = ({ id, name, values, isInvalid,
const commitBuffer = () => {
const newTag = buffer.trim().replace(/\s+/g, '_');
if (newTag.length === 0) return;
onChange && onChange(values.concat(newTag));
onChange?.(values.concat(newTag));
setBuffer('');
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const AddToCollectionButton: React.FC<AddToCollectionButtonProps> = ({
await response.json();
showToast('作成して追加しました', { color: 'success', delay: 5000 });
setShowCreateModal(false);
onCreateCollection && onCreateCollection();
onCreateCollection?.();
return;
}
throw new ResponseError(response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,8 @@ export class CollectionFormValidationError extends Error {

constructor(errors: CollectionFormErrors, ...rest: any) {
super(...rest);
if (Error.captureStackTrace) {
Error.captureStackTrace(this, CollectionFormValidationError);
}

this.name = 'CollectionFormValidationError';
this.errors = errors;
Object.setPrototypeOf(this, new.target.prototype);
}
}

Expand Down
5 changes: 0 additions & 5 deletions resources/assets/js/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,7 @@ export class ResponseError extends Error {

constructor(response: Response, ...rest: any) {
super(...rest);
if (Error.captureStackTrace) {
Error.captureStackTrace(this, ResponseError);
}

this.name = 'ResponseError';
this.response = response;
Object.setPrototypeOf(this, new.target.prototype);
}
}
3 changes: 0 additions & 3 deletions resources/assets/js/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ import { Chart, BarController, BarElement, CategoryScale, LinearScale, Legend, T
Chart.register([BarController, BarElement, CategoryScale, LinearScale, Legend, Tooltip]);

const graph = document.getElementById('global-count-graph') as HTMLCanvasElement;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const labels = JSON.parse(document.getElementById('global-count-labels')!.textContent as string);
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const data = JSON.parse(document.getElementById('global-count-data')!.textContent as string);

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
new Chart(graph.getContext('2d')!, {
type: 'bar',
data: {
Expand Down
6 changes: 2 additions & 4 deletions resources/assets/js/user/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,12 @@ if (document.getElementById('cal-heatmap')) {
},
},
[
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
[LegendLite],
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
[
Tooltip,
{
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
text: (timestamp: number, value: number, dayjsDate: Dayjs) =>
`${dayjsDate.format('YYYY/MM/DD')} - ${value || 0}回`,
},
Expand Down
9 changes: 2 additions & 7 deletions resources/assets/js/user/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@ Chart.register([
Tooltip,
]);

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const graphData = JSON.parse(document.getElementById('graph-data')!.textContent as string);

function createLineGraph(id: string, labels: string[], data: any) {
const context = (document.getElementById(id) as HTMLCanvasElement).getContext('2d');
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return new Chart(context!, {
type: 'line',
data: {
Expand Down Expand Up @@ -79,7 +77,6 @@ function createLineGraph(id: string, labels: string[], data: any) {

function createBarGraph(id: string, labels: string[], data: any) {
const context = (document.getElementById(id) as HTMLCanvasElement).getContext('2d');
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
new Chart(context!, {
type: 'bar',
data: {
Expand Down Expand Up @@ -161,14 +158,12 @@ if (document.getElementById('cal-heatmap')) {
},
},
[
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
[LegendLite],
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
[
CHTooltip,
{
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
text: (timestamp: number, value: number, dayjsDate: Dayjs) =>
`${dayjsDate.format('YYYY/MM/DD')} - ${value || 0}回`,
},
Expand Down
Loading

0 comments on commit 1f4cc81

Please sign in to comment.