Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 24 additions & 12 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ module.exports = {
plugins: [
'react-compiler',
'react-hooks',
'header',
'@tony.ganchev/header',
'jest',
'@typescript-eslint',
'regexp',
Expand Down Expand Up @@ -219,17 +219,29 @@ module.exports = {
'prefer-template': WARNING,
yoda: WARNING,

'header/header': [
'@tony.ganchev/header/header': [
ERROR,
'block',
[
'*',
' * Copyright (c) Facebook, Inc. and its affiliates.',
' *',
' * This source code is licensed under the MIT license found in the',
' * LICENSE file in the root directory of this source tree.',
' ',
],
{
header: {
commentType: 'block',
lines: [
'*',
' * Copyright (c) Facebook, Inc. and its affiliates.',
' *',
' * This source code is licensed under the MIT license found in the',
' * LICENSE file in the root directory of this source tree.',
' ',
],
},
leadingComments: {
comments: [
{
commentType: 'block',
lines: [/^\* @jest-environment \w+ $/]
}
]
}
}
],

'import/extensions': OFF,
Expand Down Expand Up @@ -483,7 +495,7 @@ module.exports = {
{
files: ['packages/create-docusaurus/templates/**/*.{js,ts,tsx}'],
rules: {
'header/header': OFF,
'@tony.ganchev/header/header': OFF,
'global-require': OFF,
'@typescript-eslint/no-var-requires': OFF,
'@docusaurus/no-untranslated-text': OFF,
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ By contributing to Docusaurus, you agree that your contributions will be license
*/
```

This is also auto-fixable with the `header/header` ESLint rule.
This is also auto-fixable with the `@tony.ganchev/header/header` ESLint rule.

### Contributor License Agreement (CLA)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"@testing-library/dom": "^10.4.1",
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/react": "^16.3.2",
"@tony.ganchev/eslint-plugin-header": "^3.3.0",
"@types/fs-extra": "^9.0.13",
"@types/jest": "^30.0.0",
"@types/lodash": "^4.14.197",
Expand All @@ -98,7 +99,6 @@
"eslint": "^8.45.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-jsx-a11y": "^6.7.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
/** @jest-environment jsdom */
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @jest-environment jsdom
*/

// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573
// eslint-disable-next-line header/header
import React from 'react';
import {renderHook} from '@testing-library/react';
import {useDocsSidebar, DocsSidebarProvider} from '../docsSidebar';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
/** @jest-environment jsdom */
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @jest-environment jsdom
*/

// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573
// eslint-disable-next-line header/header
import React from 'react';
import {renderHook} from '@testing-library/react';
import {StaticRouter} from 'react-router-dom';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
/** @jest-environment jsdom */
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @jest-environment jsdom
*/

// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573
// eslint-disable-next-line header/header
import React from 'react';
import {renderHook} from '@testing-library/react';
import {useDocsVersion, DocsVersionProvider} from '../docsVersion';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
/** @jest-environment jsdom */
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @jest-environment jsdom
*/

// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573
// eslint-disable-next-line header/header
import React from 'react';
import type {PropsWithChildren, ReactNode} from 'react';
import {render} from '@testing-library/react';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
/** @jest-environment jsdom */
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @jest-environment jsdom
*/

// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573
// eslint-disable-next-line header/header
import {renderHook} from '@testing-library/react';
import {usePrevious, useShallowMemoObject} from '../reactUtils';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
/** @jest-environment jsdom */
/**
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @jest-environment jsdom
*/

// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573
// eslint-disable-next-line header/header
import {renderHook} from '@testing-library/react';
import {useFilteredAndTreeifiedTOC, useTreeifiedTOC} from '../tocUtils';
import type {TOCItem} from '@docusaurus/mdx-loader';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
/** @jest-environment jsdom */
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @jest-environment jsdom
*/

// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573
// eslint-disable-next-line header/header
import React from 'react';
import {renderHook} from '@testing-library/react';
import {StaticRouter} from 'react-router-dom';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
/** @jest-environment jsdom */
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @jest-environment jsdom
*/

// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573
// eslint-disable-next-line header/header
import React from 'react';
import {renderHook} from '@testing-library/react';
import {StaticRouter} from 'react-router-dom';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
/** @jest-environment jsdom */
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @jest-environment jsdom
*/

// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573
// eslint-disable-next-line header/header
import {jest} from '@jest/globals';
import React from 'react';
import {renderHook} from '@testing-library/react';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
/** @jest-environment jsdom */
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @jest-environment jsdom
*/

// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573
// eslint-disable-next-line header/header
import React from 'react';
import {renderHook} from '@testing-library/react';
import {BrowserContextProvider} from '../browserContext';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
/** @jest-environment jsdom */
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @jest-environment jsdom
*/

// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573
// eslint-disable-next-line header/header
import React from 'react';
import {renderHook} from '@testing-library/react';
import {DocusaurusContextProvider} from '../docusaurusContext';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
/** @jest-environment jsdom */
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @jest-environment jsdom
*/

// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573
// eslint-disable-next-line header/header
import React from 'react';
import {renderHook} from '@testing-library/react';
import {RouteContextProvider} from '../routeContext';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
/** @jest-environment jsdom */
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @jest-environment jsdom
*/

// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573
// eslint-disable-next-line header/header
import React from 'react';
import {render} from '@testing-library/react';
import '@testing-library/jest-dom';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
/** @jest-environment jsdom */
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @jest-environment jsdom
*/

// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573
// eslint-disable-next-line header/header
import React from 'react';
import {render} from '@testing-library/react';
import '@testing-library/jest-dom';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
/** @jest-environment jsdom */
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @jest-environment jsdom
*/

// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573
// eslint-disable-next-line header/header
import React from 'react';
import {render} from '@testing-library/react';
import '@testing-library/jest-dom';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
/** @jest-environment jsdom */
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @jest-environment jsdom
*/

/* eslint-disable jsx-a11y/anchor-is-valid */
// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573
// eslint-disable-next-line header/header
import React, {type ReactNode} from 'react';
import {render as renderRTL} from '@testing-library/react';
import '@testing-library/jest-dom';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
/** @jest-environment jsdom */
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @jest-environment jsdom
*/

// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573
// eslint-disable-next-line header/header
import React from 'react';
import {render} from '@testing-library/react';
import '@testing-library/jest-dom';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
/** @jest-environment jsdom */
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @jest-environment jsdom
*/

// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573
// eslint-disable-next-line header/header
import React from 'react';
import {renderHook} from '@testing-library/react';
import {fromPartial} from '@total-typescript/shoehorn';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
/** @jest-environment jsdom */
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @jest-environment jsdom
*/

// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573
// eslint-disable-next-line header/header
import React from 'react';
import {renderHook} from '@testing-library/react';
import useGlobalData, {
Expand Down
Loading