Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(config): enables @typescript-eslint #83

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@types/supertest": "^6.0.2",
"@typescript-eslint/eslint-plugin": "^8.16.0",
"@typescript-eslint/parser": "^8.16.0",
"@typescript-eslint/eslint-plugin": "^8.17.0",
"@typescript-eslint/parser": "^8.17.0",
"@typescript-eslint/utils": "^8.16.0",
"@vitejs/plugin-react": "^4.3.4",
"c8": "^10.1.2",
Expand Down
4 changes: 2 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/commitlint/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const commitLintConfig = {
};

export const commitLintReferenceRequiredConfig = {
...commitLintConfig,
extends: ['@commitlint/config-conventional'],
rules: {
...commitLintConfig.rules,
'references-empty': [2, 'never'],
Expand Down
2 changes: 2 additions & 0 deletions src/eslint/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* Explore our open-source projects: {@link https://github.com/kurocado-studio}
*/
import babelParser from '@babel/eslint-parser';
import typescriptPlugin from '@typescript-eslint/eslint-plugin';
import typescriptParser from '@typescript-eslint/parser';
import prettierConfig from 'eslint-config-prettier';
import eslintPluginImport from 'eslint-plugin-import';
Expand Down Expand Up @@ -73,6 +74,7 @@ export const javascriptLanguageOptions = {
export const typescriptLanguageRootConfig = {
...typescriptLanguageOptions,
plugins: {
'@typescript-eslint': typescriptPlugin,
import: eslintPluginImport,
prettier: prettierConfig,
tsdoc: tsdocRecommended,
Expand Down
18 changes: 2 additions & 16 deletions src/eslint/rules/typescript/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,27 +60,13 @@ export const typescriptEslintConfig = {
'@typescript-eslint/naming-convention': [
'error',
// Anything type-like should be written in PascalCase.
{
format: ['PascalCase'],
selector: ['typeLike', 'enumMember'],
},
// Interfaces cannot be prefixed with `I`, or have restricted names.
{
custom: {
match: false,
regex: '^I[A-Z]|^(Interface|Props|State)$',
},
format: ['PascalCase'],
selector: 'interface',
},
// Types cannot be prefixed with`T ` or have restricted names.
{
custom: {
match: false,
regex: '^T[A-Z]|^(Type|Props|State)$',
regex: '^T[A-Z]|^(Type|Props|State|Interface)$',
},
format: ['PascalCase'],
selector: 'type',
selector: ['typeLike', 'typeAlias', 'enumMember'],
},
],
/**
Expand Down
5 changes: 4 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
export { commitLintConfig } from './commitlint/index.js';
export {
commitLintConfig,
commitLintReferenceRequiredConfig,
} from './commitlint/index.js';

export { eslintBaseConfig } from './eslint/eslint.base.js';
export { eslintBrowserConfig } from './eslint/eslint.browser.js';
Expand Down
Loading