mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-01-31 12:38:18 +01:00
08275f68f3
This PR adds better TypeScript types into Slate and is based on the proposal here: https://github.com/ianstormtaylor/slate/issues/3725 * Extend Slate's types like Element and Text * Supports type discrimination (ie. if an element has type === "table" then we get a reduced set of properties) * added custom types * files * more extensions * files * changed fixtures * changes eslint file * changed element.children to descendant * updated types * more type changes * changed a lot of typing, still getting building errors * extended text type in slate-react * removed type assertions * Clean up of custom types and a couple uneeded comments. * Rename headingElement-true.tsx.tsx to headingElement-true.tsx * moved basetext and baselement * Update packages/slate/src/interfaces/text.ts Co-authored-by: Brent Farese <25846953+BrentFarese@users.noreply.github.com> * Fix some type issues with core functions. * Clean up text and element files. * Convert other types to extended types. * Change the type of editor.marks to the appropriate type. * Add version 100.0.0 to package.json * Revert "Add version 100.0.0 to package.json" This reverts commit 329e44e43d968700655b1c46f968bfd3147e7339. * added custom types * files * more extensions * files * changed fixtures * changes eslint file * changed element.children to descendant * updated types * more type changes * changed a lot of typing, still getting building errors * extended text type in slate-react * removed type assertions * Clean up of custom types and a couple uneeded comments. * Rename headingElement-true.tsx.tsx to headingElement-true.tsx * moved basetext and baselement * Update packages/slate/src/interfaces/text.ts Co-authored-by: Brent Farese <25846953+BrentFarese@users.noreply.github.com> * Fix some type issues with core functions. * Clean up text and element files. * Convert other types to extended types. * Change the type of editor.marks to the appropriate type. * Run linter. * Remove key:string uknown from the base types. * Clean up types after removing key:string unknown. * Lint and prettier fixes. * Implement custom-types Co-authored-by: mdmjg <mdj308@nyu.edu> * added custom types to examples * reset yarn lock * added ts to fixtures * examples custom types * Working fix * ts-thesunny-try * Extract interface types. * Fix minor return type in create-editor. * Fix the typing issue with Location having compile time CustomTypes * Extract types for Transforms. * Update README. * Fix dependency on slate-history in slate-react Co-authored-by: mdmjg <mdj308@nyu.edu> Co-authored-by: Brent Farese <brentfarese@gmail.com> Co-authored-by: Brent Farese <25846953+BrentFarese@users.noreply.github.com> Co-authored-by: Tim Buckley <timothypbuckley@gmail.com>
182 lines
4.2 KiB
Plaintext
182 lines
4.2 KiB
Plaintext
{
|
|
"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
|
|
}
|
|
},
|
|
"ignorePatterns": ["**/next-env.d.ts"],
|
|
"settings": {
|
|
"import/extensions": [
|
|
".js",
|
|
".ts",
|
|
".jsx",
|
|
".tsx"
|
|
],
|
|
"react": {
|
|
"version": "detect"
|
|
}
|
|
},
|
|
"env": {
|
|
"browser": true,
|
|
"es6": true,
|
|
"mocha": true,
|
|
"node": true
|
|
},
|
|
"rules": {
|
|
"constructor-super": "error",
|
|
"dot-notation": [
|
|
"error",
|
|
{
|
|
"allowKeywords": true
|
|
}
|
|
],
|
|
"eqeqeq": [
|
|
"error",
|
|
"smart"
|
|
],
|
|
"import/default": "error",
|
|
"import/export": "error",
|
|
"import/first": "error",
|
|
"import/named": "error",
|
|
"import/namespace": "error",
|
|
"import/newline-after-import": "error",
|
|
"import/no-deprecated": "error",
|
|
"import/no-extraneous-dependencies": [
|
|
"error",
|
|
{
|
|
"peerDependencies": true
|
|
}
|
|
],
|
|
"import/no-mutable-exports": "error",
|
|
"import/no-named-as-default": "error",
|
|
"import/no-named-as-default-member": "error",
|
|
"import/no-unresolved": "error",
|
|
"linebreak-style": "error",
|
|
"no-array-constructor": "error",
|
|
"no-class-assign": "error",
|
|
"no-console": "error",
|
|
"no-const-assign": "error",
|
|
"no-debugger": "error",
|
|
"no-dupe-args": "error",
|
|
"no-dupe-class-members": "error",
|
|
"no-dupe-keys": "error",
|
|
"no-duplicate-case": "error",
|
|
"no-empty": "error",
|
|
"no-empty-character-class": "error",
|
|
"no-empty-pattern": "error",
|
|
"no-ex-assign": "error",
|
|
"no-extend-native": "error",
|
|
"no-extra-boolean-cast": "error",
|
|
"no-func-assign": "error",
|
|
"no-invalid-regexp": "error",
|
|
"no-native-reassign": "error",
|
|
"no-negated-in-lhs": "error",
|
|
"no-new-object": "error",
|
|
"no-new-symbol": "error",
|
|
"no-path-concat": "error",
|
|
"no-redeclare": "error",
|
|
"no-regex-spaces": "error",
|
|
"no-sequences": "error",
|
|
"no-tabs": "error",
|
|
"no-this-before-super": "error",
|
|
"no-throw-literal": "error",
|
|
"no-unneeded-ternary": "error",
|
|
"no-unreachable": "error",
|
|
"no-unsafe-finally": "error",
|
|
"no-unsafe-negation": "error",
|
|
"no-useless-call": "error",
|
|
"no-useless-computed-key": "error",
|
|
"no-useless-constructor": "error",
|
|
"no-useless-rename": "error",
|
|
"no-var": "error",
|
|
"no-void": "error",
|
|
"no-with": "error",
|
|
"object-shorthand": [
|
|
"error",
|
|
"always"
|
|
],
|
|
"prefer-arrow-callback": "error",
|
|
"prefer-const": [
|
|
"error",
|
|
{
|
|
"destructuring": "all",
|
|
"ignoreReadBeforeAssign": true
|
|
}
|
|
],
|
|
"prefer-rest-params": "error",
|
|
"prefer-spread": "error",
|
|
"prefer-template": "error",
|
|
"prettier/prettier": "error",
|
|
"radix": "error",
|
|
"react/jsx-boolean-value": [
|
|
"error",
|
|
"never"
|
|
],
|
|
"react/jsx-no-duplicate-props": "error",
|
|
"react/jsx-no-target-blank": "error",
|
|
"react/jsx-no-undef": "error",
|
|
"react/jsx-uses-react": "error",
|
|
"react/jsx-uses-vars": "error",
|
|
"react/jsx-wrap-multilines": "error",
|
|
"react/no-deprecated": "error",
|
|
"react/no-did-mount-set-state": "error",
|
|
"react/no-did-update-set-state": "error",
|
|
"react/no-string-refs": "error",
|
|
"react/no-unknown-property": "error",
|
|
"react/react-in-jsx-scope": "error",
|
|
"react/self-closing-comp": "error",
|
|
"react/sort-prop-types": "error",
|
|
"spaced-comment": [
|
|
"error",
|
|
"always",
|
|
{
|
|
"exceptions": [
|
|
"-"
|
|
]
|
|
}
|
|
],
|
|
"use-isnan": "error",
|
|
"valid-jsdoc": [
|
|
"error",
|
|
{
|
|
"prefer": {
|
|
"return": "returns"
|
|
},
|
|
"requireReturn": false
|
|
}
|
|
],
|
|
"valid-typeof": "error",
|
|
"yield-star-spacing": [
|
|
"error",
|
|
"after"
|
|
],
|
|
"yoda": [
|
|
"error",
|
|
"never"
|
|
]
|
|
},
|
|
"overrides": [
|
|
{
|
|
"files": "**/test/**/*.{js,jsx,ts,tsx}",
|
|
"rules": {
|
|
"import/no-extraneous-dependencies": "off",
|
|
"import/no-unresolved": "off"
|
|
}
|
|
}
|
|
]
|
|
} |