diff --git a/.babelrc b/.babelrc
deleted file mode 100644
index b2c668c74..000000000
--- a/.babelrc
+++ /dev/null
@@ -1,64 +0,0 @@
-{
- "presets": [
- [
- "env",
- {
- "modules": false
- }
- ],
- "react",
- "stage-0"
- ],
- "plugins": ["external-helpers"],
- "env": {
- "webpack": {
- "presets": [
- [
- "env",
- {
- "modules": false
- }
- ],
- "react",
- "stage-0"
- ],
- "plugins": ["transform-runtime", "react-hot-loader/babel"]
- },
- "test": {
- "presets": [
- [
- "env",
- {
- "exclude": ["transform-regenerator"]
- }
- ],
- "react",
- "stage-0"
- ],
- "plugins": [
- "transform-runtime",
- [
- "module-resolver",
- {
- "alias": {
- "^(slate.*)": "./packages/\\1/src"
- }
- }
- ]
- ]
- },
- "benchmark": {
- "presets": [
- [
- "env",
- {
- "exclude": ["transform-regenerator"]
- }
- ],
- "react",
- "stage-0"
- ],
- "plugins": ["transform-runtime"]
- }
- }
-}
diff --git a/.eslintignore b/.eslintignore
index dd449725e..78e9f9743 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1 +1,8 @@
*.md
+.github/
+.next/
+build/
+dist/
+lib/
+node_modules/
+tmp/
\ No newline at end of file
diff --git a/.eslintrc b/.eslintrc
index e322094fe..928636ec6 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -1,15 +1,25 @@
{
- "extends": ["prettier", "prettier/react"],
- "plugins": ["import", "react", "prettier"],
- "settings": {
- "import/extensions": [".js"]
- },
- "parser": "babel-eslint",
+ "extends": [
+ "plugin:import/typescript",
+ "prettier",
+ "prettier/@typescript-eslint",
+ "prettier/react"
+ ],
+ "plugins": ["@typescript-eslint", "import", "react", "prettier"],
+ "parser": "@typescript-eslint/parser",
"parserOptions": {
+ "sourceType": "module",
+ "ecmaVersion": 2020,
"ecmaFeatures": {
"jsx": true
}
},
+ "settings": {
+ "import/extensions": [".js", ".ts"],
+ "react": {
+ "version": "detect"
+ }
+ },
"env": {
"browser": true,
"es6": true,
@@ -36,16 +46,6 @@
"import/no-named-as-default-member": "error",
"import/no-unresolved": "error",
"linebreak-style": "error",
- "lines-around-comment": [
- "error",
- {
- "beforeBlockComment": true,
- "afterBlockComment": true,
- "allowBlockStart": true,
- "allowObjectStart": true,
- "allowArrayStart": true
- }
- ],
"no-array-constructor": "error",
"no-class-assign": "error",
"no-console": "error",
@@ -63,7 +63,6 @@
"no-extra-boolean-cast": "error",
"no-func-assign": "error",
"no-invalid-regexp": "error",
- "no-lonely-if": "error",
"no-native-reassign": "error",
"no-negated-in-lhs": "error",
"no-new-object": "error",
@@ -71,36 +70,14 @@
"no-path-concat": "error",
"no-redeclare": "error",
"no-regex-spaces": "error",
- "no-restricted-globals": [
- "error",
- "Debug",
- "document",
- "Document",
- "event",
- "history",
- "History",
- "length",
- "Map",
- "Node",
- "parent",
- "Range",
- "Selection",
- "Set",
- "Text"
- ],
"no-sequences": "error",
- "no-shadow": "error",
- "no-shadow-restricted-names": "error",
"no-tabs": "error",
"no-this-before-super": "error",
"no-throw-literal": "error",
- "no-undef": "error",
"no-unneeded-ternary": "error",
"no-unreachable": "error",
"no-unsafe-finally": "error",
"no-unsafe-negation": "error",
- "no-unused-expressions": "error",
- "no-unused-vars": ["error", { "vars": "all", "args": "none" }],
"no-useless-call": "error",
"no-useless-computed-key": "error",
"no-useless-constructor": "error",
@@ -120,7 +97,6 @@
"prettier/prettier": "error",
"radix": "error",
"react/jsx-boolean-value": ["error", "never"],
- "react/jsx-key": "error",
"react/jsx-no-duplicate-props": "error",
"react/jsx-no-target-blank": "error",
"react/jsx-no-undef": "error",
@@ -143,26 +119,14 @@
],
"valid-typeof": "error",
"yield-star-spacing": ["error", "after"],
- "yoda": ["error", "never"],
- "padding-line-between-statements": [
- "error",
- { "blankLine": "always", "prev": "multiline-expression", "next": "*" },
- { "blankLine": "any", "prev": "multiline-expression", "next": "return" },
- { "blankLine": "always", "prev": "*", "next": "multiline-expression" },
- { "blankLine": "always", "prev": "*", "next": "multiline-expression" },
- { "blankLine": "any", "prev": "empty", "next": "multiline-expression" },
- { "blankLine": "always", "prev": "multiline-block-like", "next": "*" },
- { "blankLine": "any", "prev": "multiline-block-like", "next": "return" },
- { "blankLine": "always", "prev": "*", "next": "multiline-block-like" },
- { "blankLine": "always", "prev": "*", "next": "multiline-block-like" },
- { "blankLine": "any", "prev": "case", "next": "case" }
- ]
+ "yoda": ["error", "never"]
},
"overrides": [
{
"files": "**/test/**/*.js",
"rules": {
- "import/no-extraneous-dependencies": false
+ "import/no-extraneous-dependencies": "off",
+ "import/no-unresolved": "off"
}
}
]
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
index 4427af19b..ce8b6c40d 100644
--- a/.github/ISSUE_TEMPLATE.md
+++ b/.github/ISSUE_TEMPLATE.md
@@ -1,6 +1,6 @@
#### Do you want to request a _feature_ or report a _bug_?
-
#### Have you checked that...?
-
-* [ ] The new code matches the existing patterns and styles.
-* [ ] The tests pass with `yarn test`.
-* [ ] The linter passes with `yarn lint`. (Fix errors with `yarn prettier`.)
-* [ ] The relevant examples still work. (Run examples with `yarn watch`.)
+- [ ] The new code matches the existing patterns and styles.
+- [ ] The tests pass with `yarn test`.
+- [ ] The linter passes with `yarn lint`. (Fix errors with `yarn fix`.)
+- [ ] The relevant examples still work. (Run examples with `yarn watch`.)
#### Does this fix any issues or need any specific reviewers?
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d96595cc8..983d9b845 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -4,10 +4,10 @@ jobs:
ci:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v1
- - uses: actions/setup-node@v1
- with:
- node-version: 12
- - run: yarn && yarn build && yarn lint && yarn test
- env:
- CI: true
+ - uses: actions/checkout@v1
+ - uses: actions/setup-node@v1
+ with:
+ node-version: 12
+ - run: yarn && yarn build:rollup && yarn test && yarn lint
+ env:
+ CI: true
diff --git a/.gitignore b/.gitignore
index 94b19ed8a..e2ba75075 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,26 +1,10 @@
-# Build files.
-*.js.map
+*.log
+.next/
+.vscode/
build/
dist/
lib/
-
-# Temporary files.
-tmp/
-
-# Gitbook files.
-_book/
-
-# Package files.
-lerna-debug.log
node_modules/
-npm-debug.log
-yarn-error.log
packages/*/yarn.lock
-
-# OS files.
-.DS_Store
-.idea/
-.vscode/
-
-# Editor files
-.tern-port
+site/out/
+tmp/
\ No newline at end of file
diff --git a/.prettierignore b/.prettierignore
index a24a71a6a..e768e3356 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -1,6 +1,8 @@
+.babelrc
+.next/
build/
+dist/
+lib/
node_modules/
package.json
-packages/*/dist/
-packages/*/lib/
-tmp/
+tmp/
\ No newline at end of file
diff --git a/Changelog.md b/Changelog.md
index a39f71959..89887f215 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -2,10 +2,8 @@
Since Slate is a monorepo with many packages that are versioned separately, we maintain a changelog for each individual package:
-* [`slate`](./packages/slate/Changelog.md)
-* [`slate-base64-serializer`](./packages/slate-base64-serializer/Changelog.md)
-* [`slate-html-serializer`](./packages/slate-html-serializer/Changelog.md)
-* [`slate-hyperscript`](./packages/slate-hyperscript/Changelog.md)
-* [`slate-plain-serializer`](./packages/slate-plain-serializer/Changelog.md)
-* [`slate-prop-types`](./packages/slate-prop-types/Changelog.md)
-* [`slate-react`](./packages/slate-react/Changelog.md)
+- [`slate`](./packages/slate/Changelog.md)
+- [`slate-history`](./packages/slate-history/Changelog.md)
+- [`slate-hyperscript`](./packages/slate-hyperscript/Changelog.md)
+- [`slate-react`](./packages/slate-react/Changelog.md)
+- [`slate-schema`](./packages/slate-schema/Changelog.md)
diff --git a/Contributing.md b/Contributing.md
index 6ca47e5dc..113232896 100644
--- a/Contributing.md
+++ b/Contributing.md
@@ -2,16 +2,13 @@
Want to contribute to Slate? That would be awesome!
-* [Reporting Bugs](#reporting-bugs)
-* [Asking Questions](#asking-questions)
-* [Submitting Pull Requests](#submitting-pull-requests)
-* [Running Examples](#running-examples)
-* [Running Tests](#running-tests)
-* [Running Benchmarks](#running-benchmarks)
-* [Adding Browser Support](#adding-browser-support)
-* [Testing Input Methods](#testing-input-methods)
-* [Debugging Slate Methods](#debugging-slate-methods)
-* [Publishing Releases](#publishing-releases)
+- [Reporting Bugs](#reporting-bugs)
+- [Asking Questions](#asking-questions)
+- [Submitting Pull Requests](#submitting-pull-requests)
+- [Running Examples](#running-examples)
+- [Running Tests](#running-tests)
+- [Testing Input Methods](#testing-input-methods)
+- [Publishing Releases](#publishing-releases)
## Reporting Bugs
@@ -19,9 +16,9 @@ If you run into any weird behavior while using Slate, feel free to open a new is
Any issue you open must include:
-* A [JSFiddle](https://jsfiddle.net/fj9dvhom/1/) that reproduces the bug with a minimal setup.
-* A GIF showing the issue in action. (Using something like [RecordIt](http://recordit.co/).)
-* A clear explanation of what the issue is.
+- A [JSFiddle](https://jsfiddle.net/fj9dvhom/1/) that reproduces the bug with a minimal setup.
+- A GIF showing the issue in action. (Using something like [RecordIt](http://recordit.co/).)
+- A clear explanation of what the issue is.
Here's a [JSFiddle template for Slate](https://jsfiddle.net/fj9dvhom/1/) to get you started:
@@ -70,54 +67,16 @@ If you need to debug something, you can add a `debugger` line to the source, and
If you only want to run a specific test or tests, you can run `yarn test --fgrep="slate-react rendering"` flag which will filter the tests being run by grepping for the string in each test.
-## Running Benchmarks
-
-To run the benchmarks, first make some changes to the source that you want to benchmark. Now that you're ready, you need to save a "baseline" for what the performance was before you made you change.
-
-To do that, stash your changes and save the benchmarks:
-
-```
-git stash
-yarn benchmark:save
-```
-
-Then once the reference has been saved, unstash your changes and run the benchmarks to see a comparison:
-
-```
-git stash pop
-yarn benchmark
-```
-
-There will be some subtle changes in iteration speed always, but the comparison reporter will highlight any changes that seem meaningful. You can run `benchmark` multiple times to ensure the speed up persists.
-
-### Run Selected Benchmarks
-
-To run selected benchmarks, create `tmp/benchmark-config.js` with `module.exports.include`. For example, to run slate-core benchmarks only with `get-*`, we can create a `tmp/benchmark-config.js` as
-
-```
-module.exports.include = {
- slate: /^get/
-}
-```
-
-## Adding Browser Support
-
-Slate aims to targeted all of the modern browsers, and eventually the modern mobile platforms. Right now browser support is limited to the latest versions of [Chrome](https://www.google.com/chrome/browser/desktop/), [Firefox](https://www.mozilla.org/en-US/firefox/new/), and [Safari](http://www.apple.com/safari/), but if you are interested in adding support for another modern platform, that is welcomed!
-
## Testing Input Methods
[Here's a helpful page](https://github.com/Microsoft/vscode/wiki/IME-Test) detailing how to test various input scenarios on Windows, Mac and Linux.
-## Debugging Slate Methods
-
-Slate makes use of [debug](https://github.com/visionmedia/debug) to log information about various methods. You can [enable the logger in the browser](https://github.com/visionmedia/debug#browser-support) by setting `localStorage.debug = "*"` (to log methods on all modules) or to a single namespace (e.g. `slate:editor`). Look for `const debug = Debug('