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

refactor: lexical #1954

Merged
merged 7 commits into from
Nov 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
12 changes: 12 additions & 0 deletions packages/blocks-editor/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# NOTE: In general this should be kept in sync with .eslintignore

**/dist/**
**/config/**
**/build/**
**/npm/**
**/*.js.flow
**/*.d.ts
**/playwright*/**
**/vite.config.js
**/vite.prod.config.js
**/node_modules
254 changes: 254 additions & 0 deletions packages/blocks-editor/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,254 @@
/**
* 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',
],

globals: {
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}],
},
};
1 change: 1 addition & 0 deletions packages/blocks-editor/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
15 changes: 15 additions & 0 deletions packages/blocks-editor/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# NOTE: In general this should be kept in sync with .eslintignore

packages/**/dist/*.js
packages/**/build/*.js
packages/**/npm/**/*
packages/**/config/*.js
packages/playwright
packages/playwright-core
packages/**/vite.config.js
packages/**/vite.prod.config.js
**/*.md
**/node_modules
flow-typed
.github/CODEOWNERS
.prettierignore
11 changes: 11 additions & 0 deletions packages/blocks-editor/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict';

module.exports = {
bracketSpacing: false,
singleQuote: true,
bracketSameLine: true,
printWidth: 80,
trailingComma: 'all',
htmlWhitespaceSensitivity: 'ignore',
attributeGroups: ['$DEFAULT', '^data-'],
};
94 changes: 94 additions & 0 deletions packages/blocks-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.3.6](https://github.com/standardnotes/app/compare/@standardnotes/toast@1.3.5...@standardnotes/toast@1.3.6) (2022-11-04)

**Note:** Version bump only for package @standardnotes/toast

## [1.3.5](https://github.com/standardnotes/app/compare/@standardnotes/toast@1.3.4...@standardnotes/toast@1.3.5) (2022-08-11)

### Bug Fixes

* optimize toasts for mobile ([#1392](https://github.com/standardnotes/app/issues/1392)) ([40d9392](https://github.com/standardnotes/app/commit/40d9392599e871225abcabcddd51de6cc99a0fe9))

## [1.3.4](https://github.com/standardnotes/app/compare/@standardnotes/toast@1.3.3...@standardnotes/toast@1.3.4) (2022-07-14)

**Note:** Version bump only for package @standardnotes/toast

## [1.3.3](https://github.com/standardnotes/app/compare/@standardnotes/toast@1.3.2...@standardnotes/toast@1.3.3) (2022-07-13)

**Note:** Version bump only for package @standardnotes/toast

## [1.3.2](https://github.com/standardnotes/app/compare/@standardnotes/toast@1.3.1...@standardnotes/toast@1.3.2) (2022-07-06)

**Note:** Version bump only for package @standardnotes/toast

## [1.3.1](https://github.com/standardnotes/app/compare/@standardnotes/toast@1.3.0...@standardnotes/toast@1.3.1) (2022-06-28)

**Note:** Version bump only for package @standardnotes/toast

# [1.3.0](https://github.com/standardnotes/app/compare/@standardnotes/toast@1.2.4...@standardnotes/toast@1.3.0) (2022-06-27)

### Features

* **web:** tailwind css ([#1147](https://github.com/standardnotes/app/issues/1147)) ([b80038f](https://github.com/standardnotes/app/commit/b80038f607d7411912fa99366abf559a44874ef3))

## [1.2.4](https://github.com/standardnotes/app/compare/@standardnotes/toast@1.2.4-alpha.0...@standardnotes/toast@1.2.4) (2022-06-18)

**Note:** Version bump only for package @standardnotes/toast

## [1.2.4-alpha.0](https://github.com/standardnotes/app/compare/@standardnotes/toast@1.2.3...@standardnotes/toast@1.2.4-alpha.0) (2022-06-18)

**Note:** Version bump only for package @standardnotes/toast

## 1.2.3 (2022-06-16)

**Note:** Version bump only for package @standardnotes/toast

## 1.2.2 (2022-06-16)

**Note:** Version bump only for package @standardnotes/toast

## [1.2.1](https://github.com/standardnotes/app/compare/@standardnotes/toast@1.2.1-alpha.4...@standardnotes/toast@1.2.1) (2022-06-16)

**Note:** Version bump only for package @standardnotes/toast

## 1.2.1-alpha.4 (2022-06-16)

**Note:** Version bump only for package @standardnotes/toast

## 1.2.1-alpha.3 (2022-06-16)

**Note:** Version bump only for package @standardnotes/toast

## 1.2.1-alpha.2 (2022-06-15)

**Note:** Version bump only for package @standardnotes/toast

## [1.2.1-alpha.1](https://github.com/standardnotes/app/compare/@standardnotes/toast@1.2.1-alpha.0...@standardnotes/toast@1.2.1-alpha.1) (2022-06-14)

**Note:** Version bump only for package @standardnotes/toast

## [1.2.1-alpha.0](https://github.com/standardnotes/app/compare/@standardnotes/toast@1.2.0...@standardnotes/toast@1.2.1-alpha.0) (2022-06-14)

**Note:** Version bump only for package @standardnotes/toast

# 1.2.0 (2022-06-10)

### Features

* mobile app package ([#1075](https://github.com/standardnotes/app/issues/1075)) ([8248a38](https://github.com/standardnotes/app/commit/8248a38280cb7c92da2b2e9c7db298f34ae8ffdf))
* styles package ([#1074](https://github.com/standardnotes/app/issues/1074)) ([3100327](https://github.com/standardnotes/app/commit/31003276b73d3e89824bc002fe616fa055e918c4))
* toast package ([#1073](https://github.com/standardnotes/app/issues/1073)) ([6d0b6e9](https://github.com/standardnotes/app/commit/6d0b6e9018b2a612b8df4827336883fe04033128))
* **wip:** components monorepo ([#1082](https://github.com/standardnotes/app/issues/1082)) ([e3d6001](https://github.com/standardnotes/app/commit/e3d6001a178e11e619ca724b2b155b7c0405c023))

# 1.1.0 (2022-06-10)

### Features

* mobile app package ([#1075](https://github.com/standardnotes/app/issues/1075)) ([8248a38](https://github.com/standardnotes/app/commit/8248a38280cb7c92da2b2e9c7db298f34ae8ffdf))
* styles package ([#1074](https://github.com/standardnotes/app/issues/1074)) ([3100327](https://github.com/standardnotes/app/commit/31003276b73d3e89824bc002fe616fa055e918c4))
* toast package ([#1073](https://github.com/standardnotes/app/issues/1073)) ([6d0b6e9](https://github.com/standardnotes/app/commit/6d0b6e9018b2a612b8df4827336883fe04033128))
* **wip:** components monorepo ([8c5e11c](https://github.com/standardnotes/app/commit/8c5e11c22b717ada7a6a9b3115fc4c9b757ec71c))
1 change: 1 addition & 0 deletions packages/blocks-editor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Based on https://github.com/facebook/lexical/tree/main/packages/lexical-playground