Skip to content

Commit

Permalink
feat(config): enables @typescript-eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
csantiago132 committed Dec 9, 2024
1 parent ef04c68 commit d63c8a9
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 22 deletions.
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

0 comments on commit d63c8a9

Please sign in to comment.