Skip to content

Commit

Permalink
Merge pull request yamadashy#108 from yamadashy/feature/package-upgra…
Browse files Browse the repository at this point in the history
…de-major

Draft: ESLint, yarnのmajor、その他のminor, patch バージョンアップ
  • Loading branch information
yamadashy authored May 5, 2024
2 parents 901bd45 + defbd38 commit e5310a7
Show file tree
Hide file tree
Showing 13 changed files with 4,703 additions and 4,900 deletions.
38 changes: 0 additions & 38 deletions .eslintrc.js

This file was deleted.

875 changes: 0 additions & 875 deletions .yarn/releases/yarn-3.8.2.cjs

This file was deleted.

894 changes: 894 additions & 0 deletions .yarn/releases/yarn-4.2.1.cjs

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
compressionLevel: mixed

enableGlobalCache: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.8.2.cjs
yarnPath: .yarn/releases/yarn-4.2.1.cjs
56 changes: 56 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import js from '@eslint/js';
import typescriptEslintParser from '@typescript-eslint/parser';
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import importPlugin from 'eslint-plugin-import';
import eslintPluginPrettier from 'eslint-plugin-prettier';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import globals from 'globals';

export default [
{
files: ['**/*.ts'],
languageOptions: {
globals: {
...globals.es2021,
...globals.node,
...globals.browser,
},
parser: typescriptEslintParser,
},
plugins: {
'js': js,
'@typescript-eslint': typescriptEslint,
'import': importPlugin,
'prettier': eslintPluginPrettier,
},
rules: {
...js.configs.recommended.rules,

...typescriptEslint.configs.recommended.rules,
...typescriptEslint.configs.strict.rules,
...typescriptEslint.configs.stylistic.rules,
'@typescript-eslint/no-var-requires': 'off',

...importPlugin.configs.typescript.rules,
'import/no-unresolved': 'off',
'import/prefer-default-export': 'off',

...eslintPluginPrettierRecommended.rules,
'prettier/prettier': 'warn',
},
},

{
files: ['**/*.js'],
languageOptions: {
globals: {
...globals.es2021,
...globals.node,
...globals.browser,
},
},
rules: {
...js.configs.recommended.rules,
},
},
];
20 changes: 11 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"register-index": "node --require esbuild-register src/feed/register-index-command.ts",
"site-build": "eleventy",
"site-serve": "eleventy --serve",
"lint": "eslint ./src ./tests --max-warnings 0 --ext .ts --cache --format friendly",
"lint": "eslint ./src ./tests --max-warnings 0 --cache --format friendly",
"lint-fix": "yarn lint --fix",
"type-check": "yarn tsc --noEmit",
"test": "vitest run",
Expand Down Expand Up @@ -37,39 +37,41 @@
"devDependencies": {
"@11ty/eleventy": "^2.0.1",
"@11ty/eleventy-fetch": "^4.0.0",
"@11ty/eleventy-img": "^3.1.1",
"@11ty/eleventy-img": "^4.0.2",
"@eslint/js": "^9.1.1",
"@supercharge/promise-pool": "^3.1.0",
"@types/11ty__eleventy-img": "^2.0.4",
"@types/11ty__eleventy-img": "^4.0.0",
"@types/async-retry": "^1.4.3",
"@types/eslint": "^8.4.1",
"@types/eslint-config-prettier": "^6.11.2",
"@types/eslint-plugin-prettier": "^3.1.0",
"@types/eslint__js": "~8.42.3",
"@types/html-minifier-terser": "^7.0.2",
"@types/http-server": "^0.12.1",
"@types/node": "^20.10.4",
"@types/open-graph-scraper": "^4.8.1",
"@types/prettier": "^3.0.0",
"@types/request": "^2.48.8",
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"async-retry": "^1.3.3",
"await-to-js": "^3.0.0",
"axios": "^1.6.0",
"dayjs": "^1.11.10",
"esbuild-register": "^3.5.0",
"eslint": "^8.52.0",
"eslint": "^9.1.1",
"eslint-config-prettier": "^9.0.0",
"eslint-formatter-friendly": "^7.0.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-prettier": "^5.0.1",
"fast-xml-parser": "^4.3.2",
"feed": "^4.2.2",
"googleapis": "^129.0.0",
"googleapis": "^136.0.0",
"html-minifier-terser": "^7.2.0",
"http-server": "^14.1.1",
"libxmljs": "^1.0.11",
"log4js": "^6.9.1",
"open-graph-scraper": "^4.11.0",
"open-graph-scraper": "^6.5.1",
"prettier": "^3.0.3",
"renovate": "^37.253.1",
"request": "^2.88.2",
Expand All @@ -91,5 +93,5 @@
"node": ">=20",
"yarn": ">=3.7.0"
},
"packageManager": "yarn@3.8.2"
"packageManager": "yarn@4.2.1"
}
2 changes: 1 addition & 1 deletion src/common/eleventy-cache-option.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ module.exports = {
'user-agent': constants.requestUserAgent,
},
},
}
};
4 changes: 1 addition & 3 deletions src/feed/utils/common-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import * as crypto from 'crypto';
import axios from 'axios';
import { to } from 'await-to-js';

type HatenaCountMap = {
[key: string]: number;
};
type HatenaCountMap = Record<string, number>;

export const objectDeepCopy = <T>(data: T): T => {
// TODO: Node.js 17 以上にしたら structuredClone 使う
Expand Down
6 changes: 3 additions & 3 deletions src/feed/utils/feed-crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { to } from 'await-to-js';
const ogs = require('open-graph-scraper');
const EleventyFetch = require('@11ty/eleventy-fetch');

export type OgsResult = {
export interface OgsResult {
ogTitle: string;
ogType: string;
ogUrl: string;
Expand All @@ -31,7 +31,7 @@ export type OgsResult = {
height: string;
type: string;
};
};
}
export type OgsResultMap = Map<string, OgsResult>;
export type FeedItemHatenaCountMap = Map<string, number>;
export type CustomRssParserItem = RssParser.Item & {
Expand Down Expand Up @@ -366,7 +366,7 @@ export class FeedCrawler {
}

async fetchHatenaCountMap(feedItems: CustomRssParserItem[]): Promise<FeedItemHatenaCountMap> {
const feedItemHatenaCountMap: Map<string, number> = new Map();
const feedItemHatenaCountMap = new Map<string, number>();
const feedItemUrlsChunks: string[][] = [];
let feedItemCounter = 0;

Expand Down
4 changes: 2 additions & 2 deletions src/feed/utils/feed-storer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { textToMd5Hash, textTruncate } from './common-util';
import { OutputFeedSet } from './feed-generator';
import { logger } from './logger';

export type BlogFeed = {
export interface BlogFeed {
title: string;
link: string;
linkMd5Hash: string;
Expand All @@ -20,7 +20,7 @@ export type BlogFeed = {
hatenaCount: number;
ogImageUrl: string;
}[];
};
}

export class FeedStorer {
async storeFeeds(outputFeedSet: OutputFeedSet, storeDirPath: string): Promise<void> {
Expand Down
4 changes: 2 additions & 2 deletions src/feed/utils/feed-validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { logger } from './logger';
import libxmljs from 'libxmljs';
import { to } from 'await-to-js';

export type FeedValidateResult = {
export interface FeedValidateResult {
isValid: boolean;
rssParserError: Error | null;
atomValidateError: ValidationError | null;
libxmljsError: Error | null;
};
}

/**
* フィードのバリデーション
Expand Down
4 changes: 2 additions & 2 deletions src/resources/feed-info-list.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export const FLAG_ZENN_PUBLICATION: unique symbol = Symbol('Zenn Publication');
type FEED_INFO_FLAG = typeof FLAG_ZENN_PUBLICATION;

export type FeedInfo = {
export interface FeedInfo {
label: string;
url: string;
flags?: FEED_INFO_FLAG[];
};
}

const createFeedInfoList = (feedInfoTuples: [label: string, url: string, flags?: FEED_INFO_FLAG[]][]) => {
const feedInfoList: FeedInfo[] = [];
Expand Down
Loading

0 comments on commit e5310a7

Please sign in to comment.