Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
83e54c0
WIP
jquense Dec 5, 2020
5ecbe3c
WIP
jquense Dec 5, 2020
8d4d992
WIP
jquense Dec 7, 2020
afdcc0c
WIP
jquense Dec 7, 2020
bd270d9
WIP
jquense Dec 7, 2020
3d502a8
WIP
jquense Dec 8, 2020
f9a4a1f
WIP
jquense Dec 8, 2020
07e0528
WIP
jquense Dec 8, 2020
255229c
WIP
jquense Dec 8, 2020
e725b1e
WIP
jquense Dec 9, 2020
fcd452b
WIP
jquense Dec 10, 2020
83fd387
WIP
jquense Dec 10, 2020
cb5cbc4
fix(types): meta() return type
jquense Dec 10, 2020
bc480fa
0.32.7
jquense Dec 10, 2020
48ddb90
0.32.8
jquense Dec 10, 2020
8649818
merge master
jquense Dec 10, 2020
aef1291
WIP
jquense Dec 10, 2020
129d117
Merge branch 'master' into p-33
jquense Dec 11, 2020
f49b854
Update types.ts
jquense Dec 11, 2020
d26c453
WIP
jquense Dec 14, 2020
e56fea3
feat: add describe and meta to lazy, with resolve options
jquense Dec 14, 2020
b510a3b
Merge branch 'master' into next
jquense Dec 14, 2020
b6ab05a
fix deps
jquense Dec 14, 2020
2472dad
chore: linting
jquense Dec 14, 2020
d4e3799
Publish v1.0.0-alpha.0
jquense Dec 14, 2020
495ae84
fix(types): make properties optional
jquense Dec 15, 2020
0bf9732
feat: remove unneeded Out type from schema
jquense Dec 17, 2020
ba107cb
fix(types): make properties optional
jquense Dec 15, 2020
ddb0001
Publish v1.0.0-alpha.1
jquense Dec 18, 2020
ff54374
Merge branch 'rm-out' into next
jquense Dec 18, 2020
da95a47
chore: fix build
jquense Dec 18, 2020
51ef92d
Publish v1.0.0-alpha.2
jquense Dec 18, 2020
bc284b5
fix(types): use type import/export (#1238)
michael-land Jan 27, 2021
0f12920
Merge branch 'master' into next
jquense Feb 12, 2021
c1fc816
fix: schemaOf handles Dates
jquense Feb 12, 2021
43bea65
better-flatten
jquense Feb 17, 2021
5d28a29
Merge branch 'master' into next
jquense Oct 11, 2021
3d8f998
fix up SchemaOf
jquense Oct 11, 2021
41da9b1
Merge branch 'master' into next
jquense Dec 23, 2021
eeacc92
test: convert to jest expect
jquense Dec 24, 2021
912e0be
feat: More intuitive Object generics, faster types (#1540)
jquense Dec 28, 2021
61c3e87
chore: fixup build
jquense Dec 28, 2021
23bbda5
Publish v1.0.0-alpha.3
jquense Dec 28, 2021
fcaeb42
Merge branch 'master' into next
jquense Dec 28, 2021
da74254
feat: stricter `when` types and API (#1542)
jquense Dec 28, 2021
a2f99d9
feat: concat() is shallow and does not merge (#1541)
jquense Dec 28, 2021
ce66307
docs: update readme
jquense Dec 28, 2021
7202767
chore: update to readonly arrays and test string type narrowing
jquense Dec 28, 2021
0b9809e
test: add boolean tests
jquense Dec 28, 2021
25c4aa5
docs: more docs
jquense Dec 29, 2021
3923039
feat: allow mixed schema to specify type check
jquense Dec 29, 2021
c184dcf
feat: simplify base class hierarchy (#1543)
jquense Dec 29, 2021
768e5fa
chore: prep work for toggling coercion
jquense Dec 29, 2021
fd985a2
Publish v1.0.0-alpha.4
jquense Dec 29, 2021
e7ac9f6
chore: docs
jquense Dec 29, 2021
94b73c4
feat!: add json() method and remove default object/array coercion
jquense Dec 29, 2021
a82353f
feat: Make Array generic consistent with others
jquense Dec 29, 2021
0b0b659
Publish v1.0.0-beta.0
jquense Dec 29, 2021
57b81f4
docs
jquense Dec 30, 2021
dde11ca
chore: improve internal test run APIs and Error handling (#1545)
jquense Jan 3, 2022
753abdf
feat: flat bundles and size reductions
jquense Jan 3, 2022
bb8bfcb
Publish v1.0.0-beta.1
jquense Jan 3, 2022
35af8b3
docs: pre release note
jquense Jan 3, 2022
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
14 changes: 1 addition & 13 deletions .babelrc.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,17 @@
module.exports = (api) => ({
presets: [
[
'babel-preset-jason/esm',
'babel-preset-env-modules',
api.env() !== 'test'
? {
ignoreBrowserslistConfig: true,
modules: api.env() === 'esm' ? false : 'commonjs',
}
: {
target: 'node',

// debug: true,
targets: { node: 'current' },
},
],
['@babel/preset-typescript', { allowDeclareFields: true }],
],
plugins: [
'@babel/plugin-proposal-logical-assignment-operators',
api.env() === 'modules' && [
'transform-rename-import',
{
original: 'lodash',
replacement: 'lodash-es',
},
],
].filter(Boolean),
});
9 changes: 4 additions & 5 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"env": {
"browser": true
},
"parserOptions": {
"requireConfigFile": false
},
"rules": {
"@typescript-eslint/no-shadow": "off",
"@typescript-eslint/no-empty-interface": "off"
Expand All @@ -14,18 +17,14 @@
"env": {
"jest/globals": true
},
"globals": {
"TestHelpers": false,
"sinon": true
},
"rules": {
"global-require": "off",
"no-await-in-loop": "off",
"jest/no-disabled-tests": "warn",
"jest/no-focused-tests": "error",
"jest/no-identical-title": "error",
"jest/prefer-to-have-length": "warn",
"jest/valid-expect": "off"
"@typescript-eslint/no-empty-function": "off"
}
}
]
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Test
on:
push:
branches: [master, next]
pull_request:
branches: [master, next]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 'lts/*'
cache: 'yarn'
- run: yarn install --frozen-lockfile
- run: yarn test
113 changes: 57 additions & 56 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,45 +1,46 @@
# Logs
logs
*.log
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directory
# Commenting this out is preferred by some people, see
# https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git
node_modules
# Users Environment Variables
.lock-wscript
# =========================
# Operating System Files
# =========================
# OSX
# =========================
# Logs
logs
*.log
dts/
# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# Commenting this out is preferred by some people, see
# https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git
node_modules

# Users Environment Variables
.lock-wscript

# =========================
# Operating System Files
# =========================

# OSX
# =========================

.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon
Icon


# Thumbnails
._*
Expand All @@ -54,25 +55,25 @@ Icon
Network Trash Folder
Temporary Items
.apdisk
# Windows
# =========================
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows
# =========================

# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Ignore build files
lib/
Expand Down
103 changes: 103 additions & 0 deletions CHANGELOG-pre.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# [1.0.0-beta.1](https://github.com/jquense/yup/compare/v1.0.0-beta.0...v1.0.0-beta.1) (2022-01-03)


### Features

* flat bundles and size reductions ([753abdf](https://github.com/jquense/yup/commit/753abdf329e33e43c334e405baa9c71999079480))



# [1.0.0-beta.0](https://github.com/jquense/yup/compare/v1.0.0-alpha.4...v1.0.0-beta.0) (2021-12-29)


* feat!: add json() method and remove default object/array coercion ([94b73c4](https://github.com/jquense/yup/commit/94b73c438b3d355253f488325e06c69378e71fc1))


### Features

* Make Array generic consistent with others ([a82353f](https://github.com/jquense/yup/commit/a82353f37735daec6e42d18bd4cc0efe52a20f50))


### BREAKING CHANGES

* types only, `ArraySchema` initial generic is the array type not the type of the array element. `array<T>()` is still the inner type.
* object and array schema no longer parse JSON strings by default, nor do they return `null` for invalid casts.

```ts
object().json().cast('{}')
array().json().cast('[]')
```
to mimic the previous behavior



# [1.0.0-alpha.4](https://github.com/jquense/yup/compare/v1.0.0-alpha.3...v1.0.0-alpha.4) (2021-12-29)

### Bug Fixes

- add originalValue to TestContext type ([#1527](https://github.com/jquense/yup/issues/1527)) ([fcc5ae7](https://github.com/jquense/yup/commit/fcc5ae710a1b3ef4b799532291faf894bdbcc11b)), closes [/github.com/abnersajr/DefinitelyTyped/blob/a186d99d0c3a92424691a82130374a1b9145c7cd/types/yup/index.d.ts#L446](https://github.com//github.com/abnersajr/DefinitelyTyped/blob/a186d99d0c3a92424691a82130374a1b9145c7cd/types/yup/index.d.ts/issues/L446)

### Features

- allow mixed schema to specify type check ([3923039](https://github.com/jquense/yup/commit/3923039558733d34586df2b282d34c5b6cbc5111))
- concat() is shallow and does not merge ([#1541](https://github.com/jquense/yup/issues/1541)) ([a2f99d9](https://github.com/jquense/yup/commit/a2f99d9e8d8ba1b285fa6f48a0dd77a77f629ee4))
- simplify base class hierarchy ([#1543](https://github.com/jquense/yup/issues/1543)) ([c184dcf](https://github.com/jquense/yup/commit/c184dcf644c09f3c4697cd3e5c795784a5315f77))
- stricter `when` types and API ([#1542](https://github.com/jquense/yup/issues/1542)) ([da74254](https://github.com/jquense/yup/commit/da742545a228b909fef6f7fa526ea7b459d96051))

### BREAKING CHANGES

- `mixed` schema are no longer treated as the base class for other schema types. It hasn't been for a while, but we've done some nasty prototype slinging to make it behave like it was. Now typescript types should be 1 to 1 with the actual classes yup exposes.

In general this should not affect anything unless you are extending (via `addMethod` or otherwise) `mixed` prototype.

```diff
import {
- mixed,
+ Schema,
} from 'yup';

- addMethod(mixed, 'method', impl)
+ addMethod(Schema, 'method', impl)
```

- concat works shallowly now. Previously concat functioned like a deep merge for object, which produced confusing behavior with incompatible concat'ed schema. Now concat for objects works similar to how it works for other types, the provided schema is applied on top of the existing schema, producing a new schema that is the same as calling each builder method in order
- The function version of `when()` has been changed to make it easier to type. values are always passed as an array and schema, and options always the second and third argument. `this` is no longer set to the schema instance. and all functions _must_ return a schema to be type safe

```diff
string()
- .when('other', function (other) => {
- if (other) return this.required()
+ .when('other', ([other], schema) => {
+ return other ? schema.required() : schema
})
```

# [1.0.0-alpha.3](https://github.com/jquense/yup/compare/v0.32.11...v1.0.0-alpha.3) (2021-12-28)

### Bug Fixes

- schemaOf handles Dates ([c1fc816](https://github.com/jquense/yup/commit/c1fc816cdb03f7c9ff2e6745ff38a2b4f119d556))
- **types:** use type import/export ([#1238](https://github.com/jquense/yup/issues/1238)) ([bc284b5](https://github.com/jquense/yup/commit/bc284b5dbd4541464eb4a4edee73cb4d50c00fa7))

### Features

- More intuitive Object generics, faster types ([#1540](https://github.com/jquense/yup/issues/1540)) ([912e0be](https://github.com/jquense/yup/commit/912e0bed1e0184ba9c94015dc187eb6f86bb84d5))

# [1.0.0-alpha.2](https://github.com/jquense/yup/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (2020-12-18)

# [1.0.0-alpha.1](https://github.com/jquense/yup/compare/v1.0.0-alpha.0...v1.0.0-alpha.1) (2020-12-18)

### Bug Fixes

- **types:** make properties optional ([ba107cb](https://github.com/jquense/yup/commit/ba107cb50302e5245b960ed9a33f1c2167cc5d73))
- **types:** make properties optional ([495ae84](https://github.com/jquense/yup/commit/495ae84f8bfc22b9f4310700d4d8e9586584a4c7))

### Features

- remove unneeded Out type from schema ([0bf9732](https://github.com/jquense/yup/commit/0bf97327d406c9d982b2c0a93069bd047b53d5ef))

# [1.0.0-alpha.0](https://github.com/jquense/yup/compare/v0.32.8...v1.0.0-alpha.0) (2020-12-14)

### Features

- add describe and meta to lazy, with resolve options ([e56fea3](https://github.com/jquense/yup/commit/e56fea3d09707e975fa1e3bc19fadaac4d8b065b))
Loading