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

Update deep merge interface (api) #217

Draft
wants to merge 40 commits into
base: v5
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
ca08a6c
chore(editorconfig): declare the charset
Nov 11, 2020
09c3e67
chore(editorconfig): have package.json and its lockfile keep their de…
Nov 11, 2020
9e6c637
chore(editorconfig): have markdown files keep there trailing whitespace
Nov 11, 2020
21e5999
chore(editorconfig): use space instead of tabs for markdown files
Nov 11, 2020
dc8df6b
chore(editorconfig): use space instead of tabs for yaml files
Nov 17, 2020
29b862b
chore: use files field in package.json instead of .npmignore
Nov 11, 2020
c32dfd4
chore: sort package.json fields
Nov 11, 2020
b62e6e1
refactor: move src file to src/
Nov 12, 2020
48a6eaf
refactor: move typedefs to types/
Nov 12, 2020
e246c61
chore(devdeps): update rollup to v2.33.1
Nov 11, 2020
6f2930b
chore(devdeps): update is-plain-obj to v3.0.0
Nov 12, 2020
1a82cba
chore(devdeps): update tape to v5.0.1
Nov 12, 2020
a27988f
chore(devdeps): replace uglify-js with more modern terser
Nov 12, 2020
4e74235
build(typescript): add typescript and setup the build to build with t…
Nov 12, 2020
2fb71c2
refactor: move implementation out of index file
Nov 13, 2020
5646fd6
refactor: upgrade code
Nov 13, 2020
7b894d1
perf: only compute the full options on the top level call
Nov 13, 2020
6e5dcd3
refactor: move utility functions to a utils file
Nov 13, 2020
8373879
refactor: move options stuff to its own file
Nov 13, 2020
5676ca7
add typedefs from #211
Nov 13, 2020
776fc22
test: tests types
Nov 13, 2020
a2af763
chore: refactor npm script commands
Nov 13, 2020
0a2be40
build: update package exports
Nov 18, 2020
2246372
build: add type support for older TypeScript versions
Nov 15, 2020
8c562f5
build(lint): add eslint
Nov 16, 2020
e0b302f
style(lint): apply linting fixes
Nov 16, 2020
9b55056
fix: remove circular dependency between utils and deepmerge files
Nov 19, 2020
34fab73
ci: update ci config
Nov 17, 2020
03bd8a9
ci: switch to using GitHub Actions
Nov 18, 2020
fbf00cc
docs: update readme with new js interface
Nov 17, 2020
13d6db1
test: ensure options aren't mutated
Nov 17, 2020
ded6c51
test: convert test to typescript and fixup errors this revealed
Nov 18, 2020
1e02b16
docs: update changelog
Nov 17, 2020
6494a33
build: set required node version
Nov 19, 2020
0c343f2
fix: small tweaks to types and formatting
Nov 20, 2020
ced4b6d
refactor: extract out defaultClone
RebeccaStevens Nov 27, 2020
f450b1f
feat: don't clone by deafult
RebeccaStevens Nov 27, 2020
992e0af
feat: allow a custom clone function to be provided
RebeccaStevens Nov 27, 2020
d194991
feat: custom merge is now a single function
RebeccaStevens Nov 28, 2020
049dc4f
docs: update changelog
RebeccaStevens Nov 28, 2020
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: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,19 @@ root = true
[*]
indent_style = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
indent_style = space
indent_size = 2
trim_trailing_whitespace = false

[*.yml]
indent_style = space
indent_size = 2

[{package.json,package-lock.json}]
indent_style = space
indent_size = 2
202 changes: 202 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
{
"root": true,
"parserOptions": {
"ecmaVersion": 10,
"ecmaFeatures": {
"impliedStrict": true
},
"sourceType": "module"
},
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": [
"eslint:recommended"
],
"ignorePatterns": ["dist", "types"],
"rules": {
"no-extra-boolean-cast": "error",
"array-bracket-spacing": [
"error",
"always",
{
"objectsInArrays": false
}
],
"block-spacing": ["error", "always"],
"brace-style": "error",
"comma-dangle": ["error", "always-multiline"],
"comma-spacing": [
"error",
{
"before": false,
"after": true
}
],
"comma-style": "error",
"curly": "error",
"computed-property-spacing": ["error", "never"],
"func-call-spacing": ["error", "never"],
"indent": ["error", "tab"],
"key-spacing": "error",
"keyword-spacing": "error",
"no-whitespace-before-property": "error",
"no-trailing-spaces": "error",
"object-curly-spacing": ["error", "always"],
"padded-blocks": ["error", "never"],
"semi": ["error", "never"],
"space-before-function-paren": ["error", "never"],
"space-in-parens": ["error", "never"],
"space-infix-ops": "error",
"space-unary-ops": [
"error",
{
"words": true,
"nonwords": false
}
],
"no-regex-spaces": "error",
"no-unsafe-negation": "error",
"dot-location": ["error", "property"],
"dot-notation": "error",
"no-extra-label": "error",
"no-multi-spaces": [
"error",
{
"exceptions": {
"Property": false
}
}
],
"no-useless-return": "error",
"eol-last": ["error", "always"],
"linebreak-style": "error",
"no-lonely-if": "error",
"no-unneeded-ternary": "error",
"object-curly-newline": [
"error",
{
"consistent": true
}
],
"operator-linebreak": ["error", "before"],
"quote-props": ["error", "as-needed"],
"quotes": ["error", "backtick"],
"space-before-blocks": ["error", "always"],
"spaced-comment": ["error", "always"],
"template-tag-spacing": "error",
"unicode-bom": "error",
"arrow-body-style": ["error", "as-needed"],
"arrow-parens": ["error", "always"],
"arrow-spacing": "error",
"generator-star-spacing": "error",
"no-useless-computed-key": "error",
"no-useless-rename": "error",
"no-var": "error",
"object-shorthand": "error",
"prefer-arrow-callback": [
"error",
{
"allowNamedFunctions": true
}
],
"prefer-const": "error",
"prefer-numeric-literals": "error",
"prefer-spread": "error",
"rest-spread-spacing": "error",
"template-curly-spacing": ["error", "always"],

"no-bitwise": "error",
"no-console": "off",
"no-debugger": "off",
"no-empty": "error",
"no-inner-declarations": "off",
"no-undef": "error",
"no-unused-vars": "warn"
},
"overrides": [
{
"files": [
"**/*.ts"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": [
"./tsconfig.json",
"./test/types/tsconfig.json"
]
},
"plugins": [
"@typescript-eslint"
],
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"rules": {
"@typescript-eslint/array-type": [
"error",
{
"default": "generic"
}
],
"@typescript-eslint/ban-types": [
"error",
{
"types": {
"Object": {
"message": "Use object instead",
"fixWith": "object"
},
"object": false
},
"extendDefaults": true
}
],
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/prefer-interface": "off",
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-unused-vars-experimental": [
"warn",
{
"ignoredNamesRegex": "^_",
"ignoreArgsIfArgsAfterAreUsed": true
}
],
"@typescript-eslint/no-use-before-define": [
"error",
{
"functions": false,
"variables": true
}
],

"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-includes": "warn",
"@typescript-eslint/prefer-nullish-coalescing": "warn",
"@typescript-eslint/prefer-optional-chain": "warn",
"@typescript-eslint/prefer-string-starts-ends-with": "warn",
"@typescript-eslint/prefer-ts-expect-error": "warn",
"@typescript-eslint/switch-exhaustiveness-check": "warn",
"@typescript-eslint/unified-signatures": "warn",

"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-return": "off"
}
},
{
"files": [
"**/test/**/*",
"**/*test.ts"
],
"rules": {
"no-unused-vars": "off"
}
}
]
}
49 changes: 49 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CI

on:
- push
- pull_request

jobs:
lint:
name: Linting Checks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup NodeJs
uses: actions/setup-node@v1
with:
node-version: "14"

- name: Install Dependencies
run: npm ci

- name: Run Linting Checks
run: npm run lint
test:
strategy:
fail-fast: true
matrix:
os:
- ubuntu-latest
node_version:
- "14"
- "12"
name: Test with Node ${{ matrix.node_version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup NodeJs
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node_version }}

- name: Install Dependencies
run: npm ci

- name: Run Tests
run: npm run test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
node_modules
dist/*
types/*
!types/legacy*
3 changes: 0 additions & 3 deletions .npmignore

This file was deleted.

5 changes: 0 additions & 5 deletions .travis.yml

This file was deleted.

9 changes: 9 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# [5.0.0](https://github.com/TehShrike/deepmerge/releases/tag/v5.0.0)

- Update to the internals exposed in the passed `options` object
- `deepMerge`
- `deepClone`
- Breaking: `cloneUnlessOtherwiseSpecified` has been removed - `deepClone` is very similar
- Breaking: Cloning is not turned off by default
- Breaking: Endpoint are now exported in esm style [#215](https://github.com/TehShrike/deepmerge/pull/215)
- The main merge function is now a default export
- The all merge function is now exported as "deepmergeAll" and is no longer a property on the main merge function.
- Breaking: TypeScript types have been completely reworked [#215](https://github.com/TehShrike/deepmerge/pull/215)
- Breaking for ES5 environments: `Object.assign` is now used to avoid mutating the `options` argument. [#167](https://github.com/TehShrike/deepmerge/pull/167)
- Breaking: by default, only [plain objects](https://github.com/sindresorhus/is-plain-obj/#is-plain-obj-) will have their properties merged, with all other values being copied to the target. [#152](https://github.com/TehShrike/deepmerge/issues/152)
- Breaking: the `isMergeableObject` option is renamed to `isMergeable` [#168](https://github.com/TehShrike/deepmerge/pull/168)
Expand Down
16 changes: 0 additions & 16 deletions index.d.ts

This file was deleted.

Loading