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

Restructure Codebase #215

Closed
wants to merge 37 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 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
afb122f
Merge remote-tracking branch 'upstream/v5' into v5
RebeccaStevens Jan 20, 2021
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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do tabs/trim-trailing-whitespace in Markdown too

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My reason for switching to spaces in markdown files was just to ensure they render the same regardless of what render is being used - GitHub/npm/other.
But I don't have a strong opinion on this either way. I put this change its own commit so it can easily be dropped.

The reason for not trimming trailing whitespace at the end of markdown files is because two spaces at the end of a line is part of the markdown spec (meaning add a line break here). Official markdown doesn't treat a single line break any different to a single space when it comes to rendering. However, GitHub-flavored markdown, does treat single line break as an actual line break.
If you want to continue trimming trailing whitespace I'm ok with that but I'd recommend not doing so.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whitespace at the end of the line can be meaningful in Markdown, but I never use that line-break functionality in documentation

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the indent_style should definitely be tab 😅

indent_size = 2
trim_trailing_whitespace = false

[*.yml]
indent_style = space
indent_size = 2

[{package.json,package-lock.json}]
indent_style = space
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cursed npm-enforced defaults

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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some spaces in indentation in this file it looks like

},
"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",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For linting, I use warn for everything and only use error for issues that would actually cause parse-time or run-time errors.

"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",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I detest for-of loop, personally.

I don't want to get bogged down in a full audit of this eslintrc, maybe it could be pulled out to its own PR?

"@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"
}
}
]
}
34 changes: 17 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ on:
- 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
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
Expand Down
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*
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# [5.0.0](https://github.com/TehShrike/deepmerge/releases/tag/v5.0.0)

- Breaking: Endpoint are now exported in esm style [#215](https://github.com/TehShrike/deepmerge/pull/215)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit tough for folks to go check out the PR to see exactly what the change was and run into
image

- 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