-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(eslint-plugin): support to ts on the codebase + new consistent-p…
…rops-type rule
- Loading branch information
1 parent
bec549e
commit 7b4a7fc
Showing
21 changed files
with
4,806 additions
and
292 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# package build | ||
dist |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
84 changes: 0 additions & 84 deletions
84
packages/eslint-plugin-vtex/lib/rules/prefer-early-return.js
This file was deleted.
Oops, something went wrong.
81 changes: 0 additions & 81 deletions
81
packages/eslint-plugin-vtex/lib/rules/prefer-use-effect-named-callback.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,12 @@ | |
"name": "eslint-plugin-vtex", | ||
"version": "2.2.1", | ||
"description": "VTEX's ESLint plugin", | ||
"main": "index.js", | ||
"main": "dist/eslint-plugin-vtex.cjs.js", | ||
"module": "dist/eslint-plugin-vtex.esm.js", | ||
"types": "dist/eslint-plugin-vtex.cjs.d.ts", | ||
"files": [ | ||
"index.js", | ||
"lib/" | ||
"docs", | ||
"dist" | ||
], | ||
"license": "MIT", | ||
"bugs": { | ||
|
@@ -18,16 +20,21 @@ | |
"directory": "packages/eslint-plugin-vtex" | ||
}, | ||
"contributors": [ | ||
"Christian Kaisermann <[email protected]>" | ||
"Christian Kaisermann <[email protected]>", | ||
"Gabriel Takashi Katakura <[email protected]>" | ||
], | ||
"keywords": [ | ||
"eslint", | ||
"eslint-plugin", | ||
"vtex" | ||
], | ||
"scripts": { | ||
"test": "jest", | ||
"version": "chan release $npm_package_version && git add CHANGELOG.md" | ||
"version": "chan release $npm_package_version && git add CHANGELOG.md", | ||
"watch": "tsdx watch", | ||
"build": "tsdx build", | ||
"test": "tsdx test", | ||
"lint": "tsdx lint", | ||
"prepare": "tsdx build" | ||
}, | ||
"jest": { | ||
"testPathIgnorePatterns": [ | ||
|
@@ -36,9 +43,11 @@ | |
"collectCoverage": false | ||
}, | ||
"devDependencies": { | ||
"@types/eslint": "^8.56.10", | ||
"@typescript-eslint/experimental-utils": "^5.15.0", | ||
"@typescript-eslint/parser": "^5.15.0", | ||
"jest": "^27.5.1" | ||
"jest": "^27.5.1", | ||
"tsdx": "^0.14.1" | ||
}, | ||
"peerDependencies": { | ||
"eslint": "^6 || ^7 || ^8" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { ESLintUtils } from '@typescript-eslint/utils' | ||
|
||
export const createRule = ESLintUtils.RuleCreator( | ||
(name) => | ||
`https://github.com/vtex/typescript/tree/main/packages/eslint-plugin-vtex/docs/${name}.md` | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { recommended } from './configs/recommended' | ||
import { consistentPropsType } from './rules/consistent-props-type' | ||
import { preferEarlyReturn } from './rules/prefer-early-return' | ||
import { preferUseEffectNamedCallback } from './rules/prefer-use-effect-named-callback' | ||
|
||
// tsdx doesn't support we configure our tsconfig.json | ||
// to target module commonjs, so we need to manually | ||
// use module.exports here | ||
module.exports = { | ||
configs: { | ||
recommended, | ||
}, | ||
|
||
// TODO: these rules could be auto-generated using fs+path, | ||
// but tsdx doesn't works well with dynamic imports, | ||
// so we need to change our build system first | ||
rules: { | ||
'consistent-props-type': consistentPropsType, | ||
'prefer-early-return': preferEarlyReturn, | ||
'prefer-use-effect-named-callback': preferUseEffectNamedCallback, | ||
}, | ||
} |
Oops, something went wrong.