-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #132 from thorgate/feat/improved-typings
feat: Improve typings
- Loading branch information
Showing
84 changed files
with
6,136 additions
and
6,151 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 |
---|---|---|
|
@@ -2,3 +2,5 @@ lib/ | |
jest.config.js | ||
jest.config.base.js | ||
rollup.config.js | ||
test-d/ | ||
.eslintrc.js |
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 |
---|---|---|
@@ -1,31 +1,107 @@ | ||
// @ts-check | ||
|
||
module.exports = { | ||
extends: ['@thorgate/eslint-config-typescript'], | ||
extends: [ | ||
'airbnb-base', | ||
'airbnb-typescript/base', | ||
'plugin:@typescript-eslint/recommended', | ||
'prettier', | ||
'plugin:jest/recommended', | ||
], | ||
plugins: ['@typescript-eslint', 'jest', 'prettier'], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: ['./tsconfig.eslint.json', './packages/**/tsconfig.json'], | ||
project: [ | ||
'./tsconfig.eslint.json', | ||
'./packages/**/tsconfig.eslint.json', | ||
], | ||
}, | ||
env: { | ||
es6: true, | ||
browser: true, | ||
'jest/globals': true, | ||
node: true, | ||
jest: true, | ||
}, | ||
globals: { | ||
DJ_CONST: false, | ||
django: false, | ||
}, | ||
rules: { | ||
'prettier/prettier': 'error', | ||
|
||
'no-underscore-dangle': 'off', | ||
'max-classes-per-file': 'off', | ||
'no-restricted-syntax': 'off', | ||
|
||
// route templates use template format | ||
'no-template-curly-in-string': 'off', | ||
|
||
// https://basarat.gitbooks.io/typescript/docs/tips/defaultIsBad.html | ||
'import/prefer-default-export': 'off', | ||
|
||
// Set max line length to 140 chars. Prettier formats to 80. | ||
// Using this rule so comments would be kept in more readable format | ||
'max-len': ['warn', 140], | ||
|
||
// else-return improves readability sometimes, especially with one-liners. | ||
'no-else-return': 'warn', | ||
|
||
// Allow unary ++ operator in for loop afterthoughts | ||
'no-plusplus': 'off', | ||
|
||
// Turn these into errors | ||
'no-var': 'error', | ||
|
||
// and disable these | ||
'class-methods-use-this': 'off', | ||
|
||
// Show TODOs and FIXMEs as warnings | ||
'no-warning-comments': ['warn', { location: 'anywhere' }], | ||
|
||
// Typescript configuration | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', // warn | ||
'@typescript-eslint/camelcase': 'off', | ||
'@typescript-eslint/naming-convention': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', // warn | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/no-unused-vars': [ | ||
'error', | ||
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' }, | ||
], | ||
|
||
'react/no-unescaped-entities': 'off', | ||
'react-hooks/rules-of-hooks': 'error', | ||
'react-hooks/exhaustive-deps': 'warn', | ||
// Automatically group import statements by type and sort them alphabetically. | ||
"import/order": [ | ||
"error", | ||
{ | ||
"groups": ["builtin", "external", "internal", "parent", "sibling", "index", "object", "type"], | ||
"alphabetize": { "order": "asc", "caseInsensitive": true }, | ||
"newlines-between": "always" | ||
} | ||
], | ||
|
||
// Keep imports in order | ||
'sort-imports': [ | ||
'error', | ||
{ | ||
ignoreCase: true, | ||
ignoreDeclarationSort: true, | ||
}, | ||
], | ||
|
||
// jest - fail if no except in tests | ||
'jest/expect-expect': [ | ||
'error', | ||
{ | ||
assertFunctionNames: [ | ||
'expect', | ||
'expectConfig', | ||
'expectParentValidationError', | ||
'expectError', | ||
'expectResponse', | ||
], | ||
additionalTestBlockFunctions: [], | ||
}, | ||
], | ||
}, | ||
}; |
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 |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
"description": "", | ||
"main": "dist/index.js", | ||
"module": "dist/<%PACKAGE_NAME_SAFE%>.esm.js", | ||
"typings": "dist/index.d.ts", | ||
"types": "dist/index.d.ts", | ||
"react-native": "dist/<%PACKAGE_NAME_SAFE%>.esm.js", | ||
"license": "MIT", | ||
"author": "Thorgate <[email protected]>", | ||
|
@@ -33,7 +33,7 @@ | |
"scripts": { | ||
"clean": "rimraf ./dist", | ||
"lint": "eslint src -c ../../.eslintrc.js --ext ts --ext tsx", | ||
"build": "tsdx build", | ||
"build": "dts build", | ||
"prebuild": "yarn clean && yarn lint" | ||
} | ||
} |
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
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 |
---|---|---|
@@ -1,8 +1,6 @@ | ||
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ | ||
module.exports = { | ||
bail: true, | ||
verbose: true, | ||
projects: ['<rootDir>/packages/*'], | ||
preset: 'ts-jest', | ||
preset: 'ts-jest/presets/default-esm', | ||
testEnvironment: 'node', | ||
}; |
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 |
---|---|---|
@@ -1,17 +1,11 @@ | ||
{ | ||
"lerna": "3.20.2", | ||
"packages": [ | ||
"examples/*", | ||
"packages/*" | ||
], | ||
"packages": ["examples/*", "packages/*"], | ||
"command": { | ||
"publish": { | ||
"ignoreChanges": [ | ||
"*.md" | ||
] | ||
"ignoreChanges": ["*.md"] | ||
} | ||
}, | ||
"npmClient": "yarn", | ||
"useWorkspaces": true, | ||
"version": "4.0.0-alpha.0" | ||
"version": "4.0.0-alpha.0", | ||
"$schema": "node_modules/lerna/schemas/lerna-schema.json" | ||
} |
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 |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
"description": "Abstractions on-top of `superagent` (or other Ajax libaries) for communication with REST.", | ||
"main": "dist/index.js", | ||
"module": "dist/core.esm.js", | ||
"typings": "dist/index.d.ts", | ||
"types": "dist/index.d.ts", | ||
"react-native": "dist/core.esm.js", | ||
"license": "MIT", | ||
"author": "Thorgate <[email protected]>", | ||
|
@@ -37,14 +37,22 @@ | |
], | ||
"dependencies": { | ||
"@tg-resources/is": "^3.4.0-alpha.0", | ||
"@tg-resources/route-template": "^3.4.0-alpha.1", | ||
"@tg-resources/route-template": "^4.0.0-alpha.0", | ||
"cookie": ">=0.3.1" | ||
}, | ||
"devDependencies": { | ||
"jest-extended": "^4.0.2" | ||
}, | ||
"tsd": { | ||
"compilerOptions": { | ||
"composite": false | ||
} | ||
}, | ||
"scripts": { | ||
"clean": "rimraf ./dist", | ||
"lint": "eslint src -c ../../.eslintrc.js --ext ts --ext tsx", | ||
"type-check": "dtslint --localTs ../../node_modules/typescript/lib --expectOnly type-checks", | ||
"build": "tsdx build", | ||
"lint": "eslint src test -c ../../.eslintrc.js --ext ts --ext tsx", | ||
"check-types": "tsd --show-diff", | ||
"build": "dts build", | ||
"prebuild": "yarn clean && yarn lint" | ||
} | ||
} |
Oops, something went wrong.