Skip to content

Commit

Permalink
feat: update typescript-eslint to 6.0.0 (#255)
Browse files Browse the repository at this point in the history
  • Loading branch information
donniean authored Jul 13, 2023
1 parent f7f5f20 commit febbafa
Show file tree
Hide file tree
Showing 11 changed files with 375 additions and 307 deletions.
5 changes: 2 additions & 3 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,12 @@ module.exports = {
},
},
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:@typescript-eslint/recommended-type-checked',
'plugin:@typescript-eslint/stylistic-type-checked',
'airbnb-typescript/base',
'prettier',
],
rules: {
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/consistent-type-exports': 'error',
'@typescript-eslint/consistent-type-imports': [
'error',
Expand Down
644 changes: 356 additions & 288 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,15 @@
"@types/prompts": "^2.4.4",
"@types/shelljs": "^0.8.12",
"@types/sort-object-keys": "^1.1.0",
"@typescript-eslint/eslint-plugin": "^5.61.0",
"@typescript-eslint/parser": "^5.61.0",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@vitest/coverage-v8": "^0.33.0",
"commitizen": "^4.3.0",
"cspell": "^6.31.1",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.44.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-config-prettier": "^8.8.0",
"eslint-import-resolver-typescript": "^3.5.5",
"eslint-plugin-eslint-comments": "^3.2.0",
Expand Down
6 changes: 4 additions & 2 deletions src/cli/create/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ export default async function handler({

FEATURE_OPTIONS.forEach(({ key }) => {
if (normalizedFeatures?.[key]) {
const onAfterAllSuccess = // @ts-ignore
features[key]?.onAfterAllSuccess as OnAfterAllSuccess | undefined;
// @ts-expect-error has onAfterAllSuccess
const onAfterAllSuccess = features[key]?.onAfterAllSuccess as
| OnAfterAllSuccess
| undefined;
if (typeof onAfterAllSuccess === 'function') {
onAfterAllSuccess({ featureKey: key, normalizedConfigsConfig });
}
Expand Down
2 changes: 1 addition & 1 deletion src/features/eslint/rules/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getExtensionsPattern } from '@/utils/misc';
import type { ESLintConfig } from '../types';
import { airbnbBase } from '../utils';

// @ts-ignore
// @ts-expect-error no error
const noExtraneousDependenciesOptions = airbnbBase.imports.rules?.[
'import/no-extraneous-dependencies'
]?.[1] as { devDependencies: string[] };
Expand Down
4 changes: 2 additions & 2 deletions src/features/eslint/rules/react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { makeJavaScriptOnlyValue } from '@/utils/misc';
import type { ESLintConfig } from '../types';
import { airbnbBase } from '../utils';

// @ts-ignore
// @ts-expect-error no error
const noParamReassignOptions = airbnbBase.bestPractices.rules?.[
'no-param-reassign'
]?.[1] as { ignorePropertyModificationsFor: string[] };
Expand All @@ -20,7 +20,7 @@ function getConfig(): ESLintConfig {
return {
extends: ['airbnb/hooks', 'plugin:react/jsx-runtime'],
rules: {
// @ts-ignore
// @ts-expect-error no error
'no-console': makeJavaScriptOnlyValue(
`process.env.NODE_ENV === 'development' ? 'warn' : ['error', { allow: ['warn', 'error'] }]`,
),
Expand Down
5 changes: 2 additions & 3 deletions src/features/eslint/rules/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@ function getConfig({ hasReact }: Options): ESLintConfig {
},
},
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:@typescript-eslint/recommended-type-checked',
'plugin:@typescript-eslint/stylistic-type-checked',
hasReact ? 'airbnb-typescript' : 'airbnb-typescript/base',
],
rules: {
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/consistent-type-exports': 'error',
'@typescript-eslint/consistent-type-imports': [
'error',
Expand Down
4 changes: 2 additions & 2 deletions src/utils/configs-config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async function outputConfigsConfig({
filePath = paths.resolveCwd(CONFIGS_CONFIG_FILE_NAME),
data,
}: OutputConfigsConfigSyncOptions) {
// @ts-ignore
// @ts-expect-error no error
await files.outputCjsFile({ filePath, data });
}

Expand All @@ -47,7 +47,7 @@ function normalizeConfigsConfig(configsConfig: ConfigsConfig) {
});
}

// @ts-ignore
// @ts-expect-error no error
finalConfigsConfig = cleanDeep(finalConfigsConfig, { cleanValues: [false] });

if (configsConfig.features?.gitignore === true) {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/handlers/package-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ export async function handlePackageJson({
const data = merge({}, rest, {
devDependencies: devDependenciesWithVersion,
});
// @ts-ignore
// @ts-expect-error no error
mergeCwdPackageJsonSync({ data });
}
2 changes: 1 addition & 1 deletion src/utils/misc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function stringifyJavaScript(input: unknown) {
typeof value === 'object' &&
Object.prototype.hasOwnProperty.call(value, id)
) {
const v = value as { [id: string]: string };
const v = value as Record<string, string>;
return v[id];
}
return next(value);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/package-json/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function checkCwdPackageJsonSync() {

export function mergeCwdPackageJsonSync({ data }: MergePackageJsonSyncOptions) {
const filePath = paths.cwdPackageJson;
return files.mergeJsonFileSync({ filePath, data });
files.mergeJsonFileSync({ filePath, data });
}

export function sortCwdPackageJsonSync() {
Expand Down

0 comments on commit febbafa

Please sign in to comment.