-
-
Notifications
You must be signed in to change notification settings - Fork 391
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: upgrade lexical & make linting/formatting consistent with web …
…codebase (#2144)
- Loading branch information
1 parent
5735380
commit c24be60
Showing
76 changed files
with
2,426 additions
and
3,225 deletions.
There are no files selected for viewing
Binary file renamed
BIN
+11.2 KB
...board-npm-0.7.5-0d475b4b93-a3fb01ecd9.zip → ...board-npm-0.7.6-255284171a-2cc08a28f9.zip
Binary file not shown.
Binary file renamed
BIN
+18.4 KB
...-code-npm-0.7.5-259fe40fd2-14522373ae.zip → ...-code-npm-0.7.6-8d90919312-67c688ae05.zip
Binary file not shown.
Binary file renamed
BIN
+4.98 KB
...ragon-npm-0.7.5-83f3b2cd75-690e051f44.zip → ...ragon-npm-0.7.6-7319a27c5f-d565cc502f.zip
Binary file not shown.
Binary file renamed
BIN
+5.21 KB
...shtag-npm-0.7.5-c870be93b0-783fd2d6c0.zip → ...shtag-npm-0.7.6-cb2dd3c9f8-352251fc41.zip
Binary file not shown.
Binary file renamed
BIN
+7.79 KB
...story-npm-0.7.5-87faae9135-34569fc29d.zip → ...story-npm-0.7.6-b152d0a748-7461b6ace7.zip
Binary file not shown.
Binary file renamed
BIN
+7.04 KB
...-html-npm-0.7.5-254521d200-bf88318aac.zip → ...-html-npm-0.7.6-401fe69ed6-a53778ab12.zip
Binary file not shown.
Binary file renamed
BIN
+8.22 KB
...-link-npm-0.7.5-5f90a49a95-153f88575a.zip → ...-link-npm-0.7.6-60abf23443-ecf487bfd9.zip
Binary file not shown.
Binary file renamed
BIN
+18.6 KB
...-list-npm-0.7.5-731f1ee6f8-f44602977a.zip → ...-list-npm-0.7.6-f677249d18-74b02536f7.zip
Binary file not shown.
Binary file renamed
BIN
+8.44 KB
...-mark-npm-0.7.5-099512c9d8-3e8641a71c.zip → ...-mark-npm-0.7.6-f096cb3ed4-fe361ce192.zip
Binary file not shown.
Binary file renamed
BIN
+21.6 KB
...kdown-npm-0.7.5-ef30748329-ac27bd5309.zip → ...kdown-npm-0.7.6-ac9069351c-1d73027e84.zip
Binary file not shown.
Binary file renamed
BIN
+8.21 KB
...ffset-npm-0.7.5-8882f69b1d-f5b713e551.zip → ...ffset-npm-0.7.6-0170285adb-249a2684de.zip
Binary file not shown.
Binary file renamed
BIN
+5.04 KB
...rflow-npm-0.7.5-2fe419046b-a4694a96b6.zip → ...rflow-npm-0.7.6-05e5eac593-77755f1ed9.zip
Binary file not shown.
Binary file renamed
BIN
+6.68 KB
...-text-npm-0.7.5-16effec12d-506d87b7f1.zip → ...-text-npm-0.7.6-9f6b884784-f9d3cd04be.zip
Binary file not shown.
Binary file renamed
BIN
+178 KB
...react-npm-0.7.5-849c90abbd-0df2bd2c3d.zip → ...react-npm-0.7.6-f61ab83ba8-f98a47b09e.zip
Binary file not shown.
Binary file renamed
BIN
+12.8 KB
...-text-npm-0.7.5-9c3b4d905f-8b58eae116.zip → ...-text-npm-0.7.6-fea6f76fd7-53ddbd4e2a.zip
Binary file not shown.
Binary file renamed
BIN
+17.3 KB
...ction-npm-0.7.5-f94c2e706d-57907d740d.zip → ...ction-npm-0.7.6-ca85f6e7e8-522d6ea559.zip
Binary file not shown.
Binary file renamed
BIN
+24.8 KB
...table-npm-0.7.5-93069cd3a8-6d0b3177d4.zip → ...table-npm-0.7.6-640c4a673d-2c6e93516b.zip
Binary file not shown.
Binary file renamed
BIN
+6.69 KB
...-text-npm-0.7.5-7f8ed6c23d-445d9dd3cc.zip → ...-text-npm-0.7.6-8bf483ebf2-f8d645dfbd.zip
Binary file not shown.
Binary file renamed
BIN
+9.26 KB
...utils-npm-0.7.5-f46814baef-9f46fe5641.zip → ...utils-npm-0.7.6-5f6106fcc4-7562549583.zip
Binary file not shown.
Binary file renamed
BIN
+28.2 KB
...l-yjs-npm-0.7.5-2a6f22137f-af25e26130.zip → ...l-yjs-npm-0.7.6-618ae81f79-9337f066ad.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+207 KB
...ndcss-npm-0.2.0-1d6c5eaa79-427cd16e5c.zip → ...ndcss-npm-0.2.1-848c29a572-5a04b26f50.zip
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,254 +1,18 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const restrictedGlobals = require('confusing-browser-globals'); | ||
|
||
const OFF = 0; | ||
const ERROR = 2; | ||
|
||
module.exports = { | ||
root: true, | ||
// Prettier must be last so it can override other configs (https://github.com/prettier/eslint-config-prettier#installation) | ||
extends: [ | ||
'fbjs', | ||
'plugin:react-hooks/recommended', | ||
'plugin:lexical/all', | ||
'prettier', | ||
], | ||
|
||
extends: ['../../common.eslintrc.js', 'plugin:react-hooks/recommended'], | ||
parserOptions: { | ||
project: './tsconfig.json', | ||
tsconfigRootDir: __dirname, | ||
}, | ||
ignorePatterns: ['**/*.spec.ts', '__mocks__'], | ||
plugins: ['@typescript-eslint', 'react', 'react-hooks', 'prettier'], | ||
env: { | ||
browser: true, | ||
}, | ||
globals: { | ||
__WEB_VERSION__: true, | ||
JSX: true, | ||
__DEV__: true, | ||
}, | ||
|
||
overrides: [ | ||
{ | ||
// We apply these settings to the source files that get compiled. | ||
// They can use all features including JSX (but shouldn't use `var`). | ||
files: [ | ||
'packages/*/src/**/*.js', | ||
'packages/*/__tests__/**/*.?(m)js', | ||
'packages/*/src/**/*.jsx', | ||
], | ||
parser: 'babel-eslint', | ||
parserOptions: { | ||
allowImportExportEverywhere: true, | ||
sourceType: 'module', | ||
}, | ||
rules: { | ||
'no-var': ERROR, | ||
'prefer-const': ERROR, | ||
strict: OFF, | ||
}, | ||
}, | ||
{ | ||
// node scripts should be console logging so don't lint against that | ||
files: ['scripts/**/*.js'], | ||
rules: { | ||
'no-console': OFF, | ||
}, | ||
}, | ||
{ | ||
env: { | ||
browser: true, | ||
}, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/eslint-recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
], | ||
files: ['**/*.ts', '**/*.tsx'], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
sourceType: 'module', | ||
}, | ||
plugins: ['react', '@typescript-eslint', 'header'], | ||
rules: { | ||
'@typescript-eslint/ban-ts-comment': OFF, | ||
'@typescript-eslint/no-this-alias': OFF, | ||
'@typescript-eslint/no-unused-vars': [ERROR, {args: 'none'}], | ||
'header/header': [2, 'scripts/www/headerTemplate.js'], | ||
}, | ||
}, | ||
{ | ||
// don't lint headers in entrypoint files so we can add TypeDoc module comments | ||
files: ['packages/**/src/index.ts'], | ||
rules: { | ||
'header/header': OFF, | ||
}, | ||
}, | ||
{ | ||
files: [ | ||
'packages/**/src/__tests__/**', | ||
'packages/lexical-playground/**', | ||
'packages/lexical-devtools/**', | ||
], | ||
rules: { | ||
'lexical/no-optional-chaining': OFF, | ||
}, | ||
}, | ||
], | ||
|
||
parser: 'babel-eslint', | ||
|
||
parserOptions: { | ||
ecmaFeatures: { | ||
experimentalObjectRestSpread: true, | ||
}, | ||
ecmaVersion: 8, | ||
sourceType: 'script', | ||
}, | ||
|
||
plugins: [ | ||
'sort-keys-fix', | ||
'simple-import-sort', | ||
'header', | ||
|
||
// import helps to configure simple-import-sort | ||
'import', | ||
'jest', | ||
'no-function-declare-after-return', | ||
'react', | ||
'no-only-tests', | ||
'lexical', | ||
], | ||
|
||
// Stop ESLint from looking for a configuration file in parent folders | ||
root: true, | ||
// We're stricter than the default config, mostly. We'll override a few rules | ||
// and then enable some React specific ones. | ||
rules: { | ||
'accessor-pairs': OFF, | ||
|
||
'brace-style': [ERROR, '1tbs'], | ||
'consistent-return': OFF, | ||
'dot-location': [ERROR, 'property'], | ||
// We use console['error']() as a signal to not transform it: | ||
'dot-notation': [ERROR, {allowPattern: '^(error|warn)$'}], | ||
|
||
'eol-last': ERROR, | ||
eqeqeq: [ERROR, 'allow-null'], | ||
// Prettier forces semicolons in a few places | ||
'flowtype/object-type-delimiter': OFF, | ||
|
||
'flowtype/sort-keys': ERROR, | ||
|
||
'header/header': [2, 'scripts/www/headerTemplate.js'], | ||
|
||
// (This helps configure simple-import-sort) Make sure all imports are at the top of the file | ||
'import/first': ERROR, | ||
|
||
// (This helps configure simple-import-sort) Make sure there's a newline after the imports | ||
'import/newline-after-import': ERROR, | ||
|
||
// (This helps configure simple-import-sort) Merge imports of the same file | ||
'import/no-duplicates': ERROR, | ||
|
||
indent: OFF, | ||
|
||
'jsx-quotes': [ERROR, 'prefer-double'], | ||
|
||
'keyword-spacing': [ERROR, {after: true, before: true}], | ||
|
||
// Enforced by Prettier | ||
// TODO: Prettier doesn't handle long strings or long comments. Not a big | ||
// deal. But I turned it off because loading the plugin causes some obscure | ||
// syntax error and it didn't seem worth investigating. | ||
'max-len': OFF, | ||
|
||
'no-bitwise': OFF, | ||
|
||
'no-console': ERROR, | ||
|
||
'no-debugger': ERROR, | ||
|
||
// Prevent function declarations after return statements | ||
'no-function-declare-after-return/no-function-declare-after-return': ERROR, | ||
|
||
'no-inner-declarations': [ERROR, 'functions'], | ||
|
||
'no-multi-spaces': ERROR, | ||
|
||
'no-only-tests/no-only-tests': ERROR, | ||
|
||
'no-restricted-globals': [ERROR].concat(restrictedGlobals), | ||
|
||
'no-restricted-syntax': [ERROR, 'WithStatement'], | ||
|
||
'no-shadow': ERROR, | ||
|
||
'no-unused-expressions': ERROR, | ||
|
||
'no-unused-vars': [ERROR, {args: 'none'}], | ||
|
||
'no-use-before-define': OFF, | ||
|
||
// Flow fails with with non-string literal keys | ||
'no-useless-computed-key': OFF, | ||
|
||
'no-useless-concat': OFF, | ||
|
||
// We apply these settings to files that should run on Node. | ||
// They can't use JSX or ES6 modules, and must be in strict mode. | ||
// They can, however, use other ES6 features. | ||
// (Note these rules are overridden later for source files.) | ||
'no-var': ERROR, | ||
|
||
quotes: [ERROR, 'single', {allowTemplateLiterals: true, avoidEscape: true}], | ||
|
||
// React & JSX | ||
// Our transforms set this automatically | ||
'react/jsx-boolean-value': [ERROR, 'always'], | ||
|
||
'react/jsx-no-undef': ERROR, | ||
|
||
// We don't care to do this | ||
'react/jsx-sort-prop-types': OFF, | ||
|
||
'react/jsx-tag-spacing': ERROR, | ||
|
||
'react/jsx-uses-react': ERROR, | ||
|
||
// We don't care to do this | ||
'react/jsx-wrap-multilines': [ | ||
ERROR, | ||
{assignment: false, declaration: false}, | ||
], | ||
|
||
'react/no-is-mounted': OFF, | ||
|
||
// This isn't useful in our test code | ||
'react/react-in-jsx-scope': ERROR, | ||
|
||
'react/self-closing-comp': ERROR, | ||
|
||
// This sorts re-exports (`export * from 'foo';`), but not other types of exports. | ||
'simple-import-sort/exports': ERROR, | ||
|
||
'simple-import-sort/imports': [ | ||
ERROR, | ||
{ | ||
// The default grouping, but with type imports first as a separate group. | ||
// See: https://github.com/lydell/eslint-plugin-simple-import-sort/blob/d9a116f71302c5dcfc1581fc7ded8d77392f1924/examples/.eslintrc.js#L122-L133 | ||
groups: [['^.*\\u0000$'], ['^\\u0000'], ['^@?\\w'], ['^'], ['^\\.']], | ||
}, | ||
], | ||
|
||
'sort-keys-fix/sort-keys-fix': ERROR, | ||
|
||
'space-before-blocks': ERROR, | ||
|
||
'space-before-function-paren': OFF, | ||
|
||
strict: ERROR, | ||
|
||
'valid-typeof': [ERROR, {requireStringLiterals: true}], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,7 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
bracketSpacing: false, | ||
singleQuote: true, | ||
bracketSameLine: true, | ||
printWidth: 80, | ||
trailingComma: 'all', | ||
htmlWhitespaceSensitivity: 'ignore', | ||
attributeGroups: ['$DEFAULT', '^data-'], | ||
printWidth: 120, | ||
semi: false, | ||
plugins: [require('prettier-plugin-tailwindcss')], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.