diff --git a/.eslintrc.js b/.eslintrc.js index 94bf6675d..f02e0a4ed 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,3 +1,11 @@ +/** + * 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'); @@ -78,6 +86,8 @@ module.exports = { plugins: [ 'sort-keys-fix', 'simple-import-sort', + 'header', + // import helps to configure simple-import-sort 'import', 'jest', @@ -92,11 +102,13 @@ module.exports = { // 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 @@ -104,6 +116,8 @@ module.exports = { '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, diff --git a/babel.config.js b/babel.config.js index 7b448b8d9..ff972262b 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,3 +1,11 @@ +/** + * 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'; module.exports = { diff --git a/jest.config.js b/jest.config.js index 143a3f93d..10d16d400 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,3 +1,11 @@ +/** + * 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 common = { diff --git a/libdefs/dom.js b/libdefs/dom.js index 2f1374738..631003d96 100644 --- a/libdefs/dom.js +++ b/libdefs/dom.js @@ -1,4 +1,12 @@ -/* eslint-disable strict */ +/** + * 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. + * + */ + +// eslint-disable-next-line strict declare type WindowSelection = { anchorNode: Node | null, anchorOffset: number, diff --git a/libdefs/environment.js b/libdefs/environment.js index c1012f71f..37b97342e 100644 --- a/libdefs/environment.js +++ b/libdefs/environment.js @@ -4,7 +4,6 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict */ 'use strict'; diff --git a/libdefs/prismjs.js b/libdefs/prismjs.js index 05aaca555..0aca744ec 100644 --- a/libdefs/prismjs.js +++ b/libdefs/prismjs.js @@ -1,3 +1,11 @@ +/** + * 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'; type TokenStream = Array; diff --git a/libdefs/react.js b/libdefs/react.js index cda171b5f..125da28ae 100644 --- a/libdefs/react.js +++ b/libdefs/react.js @@ -1,4 +1,13 @@ -/* eslint-disable strict */ +/** + * 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. + * + */ + // Flow comes with a pretty good library definitions for React, and it // includes a type for useRef but no definition for the ref object itself. + +// eslint-disable-next-line strict declare type RefObject = {current: null | T}; diff --git a/libdefs/yjs.js b/libdefs/yjs.js index e09bd44c7..b58fc7a83 100644 --- a/libdefs/yjs.js +++ b/libdefs/yjs.js @@ -4,7 +4,6 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict */ 'use strict'; diff --git a/packages/lexical-playground/__tests__/e2e/CharacterLimit.spec.mjs b/packages/lexical-playground/__tests__/e2e/CharacterLimit.spec.mjs index ad87eadd7..d243012f0 100644 --- a/packages/lexical-playground/__tests__/e2e/CharacterLimit.spec.mjs +++ b/packages/lexical-playground/__tests__/e2e/CharacterLimit.spec.mjs @@ -4,7 +4,6 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict */ import { diff --git a/packages/lexical-playground/__tests__/utils/index.mjs b/packages/lexical-playground/__tests__/utils/index.mjs index a4bf39ae8..1aabe3a46 100644 --- a/packages/lexical-playground/__tests__/utils/index.mjs +++ b/packages/lexical-playground/__tests__/utils/index.mjs @@ -4,7 +4,6 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict */ import {expect, test as base} from '@playwright/test'; diff --git a/packages/lexical-website-new/babel.config.js b/packages/lexical-website-new/babel.config.js index 468cd8c31..ab18191bf 100644 --- a/packages/lexical-website-new/babel.config.js +++ b/packages/lexical-website-new/babel.config.js @@ -1,3 +1,11 @@ +/** + * 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'; module.exports = { diff --git a/packages/lexical-website-new/docusaurus.config.js b/packages/lexical-website-new/docusaurus.config.js index 90ad8afa9..cbbd50955 100644 --- a/packages/lexical-website-new/docusaurus.config.js +++ b/packages/lexical-website-new/docusaurus.config.js @@ -4,7 +4,6 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * */ 'use strict'; diff --git a/packages/lexical-website-new/plugins/webpack-buffer/index.js b/packages/lexical-website-new/plugins/webpack-buffer/index.js index 7a0b3b55d..b55366723 100644 --- a/packages/lexical-website-new/plugins/webpack-buffer/index.js +++ b/packages/lexical-website-new/plugins/webpack-buffer/index.js @@ -4,8 +4,8 @@ * 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 webpack = require('webpack'); diff --git a/packages/lexical-website-new/sidebars.js b/packages/lexical-website-new/sidebars.js index 233f37393..2a736969d 100644 --- a/packages/lexical-website-new/sidebars.js +++ b/packages/lexical-website-new/sidebars.js @@ -4,7 +4,6 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * */ 'use strict'; diff --git a/packages/lexical-website-new/src/components/CommunityLinks/index.js b/packages/lexical-website-new/src/components/CommunityLinks/index.js index 5fd6561da..529d95010 100644 --- a/packages/lexical-website-new/src/components/CommunityLinks/index.js +++ b/packages/lexical-website-new/src/components/CommunityLinks/index.js @@ -4,7 +4,6 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * */ import Link from '@docusaurus/Link'; diff --git a/packages/lexical-website-new/src/components/ImageSwitcher/index.js b/packages/lexical-website-new/src/components/ImageSwitcher/index.js index 93f9b9530..e4d20a867 100644 --- a/packages/lexical-website-new/src/components/ImageSwitcher/index.js +++ b/packages/lexical-website-new/src/components/ImageSwitcher/index.js @@ -4,7 +4,6 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * */ import {useColorMode} from '@docusaurus/theme-common'; diff --git a/playwright.config.js b/playwright.config.js index a36f71bf0..a12c4a49c 100644 --- a/playwright.config.js +++ b/playwright.config.js @@ -1,3 +1,11 @@ +/** + * 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 {devices} = require('@playwright/test'); diff --git a/scripts/build.js b/scripts/build.js index 8c8303502..69a5ae107 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -3,6 +3,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. + * */ 'use strict'; diff --git a/scripts/check-flow-types.js b/scripts/check-flow-types.js index 5f65ba7ee..b073ad27c 100644 --- a/scripts/check-flow-types.js +++ b/scripts/check-flow-types.js @@ -3,6 +3,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. + * */ 'use strict'; diff --git a/scripts/clean.js b/scripts/clean.js index c53b3dcf5..bc7ef8788 100644 --- a/scripts/clean.js +++ b/scripts/clean.js @@ -3,6 +3,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. + * */ 'use strict'; diff --git a/scripts/error-codes/evalToString.js b/scripts/error-codes/evalToString.js index 442b71bb2..f61ff535e 100644 --- a/scripts/error-codes/evalToString.js +++ b/scripts/error-codes/evalToString.js @@ -4,8 +4,8 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow */ + 'use strict'; function evalToString(ast /* : Object */) /* : string */ { diff --git a/scripts/error-codes/extract-errors.js b/scripts/error-codes/extract-errors.js index 611c1b0e7..fc12e8c97 100644 --- a/scripts/error-codes/extract-errors.js +++ b/scripts/error-codes/extract-errors.js @@ -3,7 +3,9 @@ * * 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 parser = require('@babel/parser'); diff --git a/scripts/error-codes/formatProdErrorMessage.js b/scripts/error-codes/formatProdErrorMessage.js index ccbf4d6db..d712749eb 100644 --- a/scripts/error-codes/formatProdErrorMessage.js +++ b/scripts/error-codes/formatProdErrorMessage.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * */ + 'use strict'; // Do not require this module directly! Use normal `invariant` calls with diff --git a/scripts/error-codes/invertObject.js b/scripts/error-codes/invertObject.js index 71cb7f3de..1029e6c25 100644 --- a/scripts/error-codes/invertObject.js +++ b/scripts/error-codes/invertObject.js @@ -4,8 +4,8 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow */ + 'use strict'; /*:: import type { ErrorMap } from './Types' */ diff --git a/scripts/error-codes/transform-error-messages.js b/scripts/error-codes/transform-error-messages.js index 34f18e550..6dd338703 100644 --- a/scripts/error-codes/transform-error-messages.js +++ b/scripts/error-codes/transform-error-messages.js @@ -3,7 +3,9 @@ * * 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 fs = require('fs'); diff --git a/scripts/npm/packages.js b/scripts/npm/packages.js index dfbdc760d..2073e8199 100644 --- a/scripts/npm/packages.js +++ b/scripts/npm/packages.js @@ -6,7 +6,6 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict */ 'use strict'; diff --git a/scripts/npm/prepare-release.js b/scripts/npm/prepare-release.js index f46dc9499..b7ba66461 100644 --- a/scripts/npm/prepare-release.js +++ b/scripts/npm/prepare-release.js @@ -6,7 +6,6 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict */ 'use strict'; diff --git a/scripts/npm/release.js b/scripts/npm/release.js index 446d3d17a..03168c450 100644 --- a/scripts/npm/release.js +++ b/scripts/npm/release.js @@ -6,7 +6,6 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict */ 'use strict'; diff --git a/scripts/updateVersion.js b/scripts/updateVersion.js index 2880f95bc..2d3f2be2f 100644 --- a/scripts/updateVersion.js +++ b/scripts/updateVersion.js @@ -3,6 +3,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. + * */ 'use strict'; diff --git a/scripts/www/rewriteImports.js b/scripts/www/rewriteImports.js index 39537d31e..68de4e800 100644 --- a/scripts/www/rewriteImports.js +++ b/scripts/www/rewriteImports.js @@ -3,6 +3,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. + * */ 'use strict';