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

React/ESLint: enable react/react-in-jsx-scope #11489

Closed
wants to merge 1 commit into from
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
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ private Consumer<JHipsterModuleBuilder> patchEslintConfig(JHipsterModuleProperti
.add(
regex("[ \\t]+quotes: \\['error', 'single', \\{ avoidEscape: true }],"),
"""
\t\t\t'react/react-in-jsx-scope': 'off',
\t\t\t'@typescript-eslint/no-explicit-any': 'off',
\t\t\t'@typescript-eslint/await-thenable': 'off',
\t\t\t'@typescript-eslint/consistent-type-imports': 'error',
Expand Down Expand Up @@ -170,6 +169,7 @@ private Consumer<JHipsterModuleBuilder> patchTsConfig(JHipsterModuleProperties p
.add(tsConfigCompilerOption("composite", false, properties.indentation()))
.add(tsConfigCompilerOption("forceConsistentCasingInFileNames", true, properties.indentation()))
.add(tsConfigCompilerOption("allowSyntheticDefaultImports", true, properties.indentation()))
.add(tsConfigCompilerOption("jsx", "react", properties.indentation()))
.add(text(DEFAULT_TSCONFIG_PATH), pathsReplacement)
.and()
.and();
Expand All @@ -181,6 +181,11 @@ private static MandatoryReplacer tsConfigCompilerOption(String optionName, boole
return new MandatoryReplacer(lineAfterRegex("\"compilerOptions\":"), compilerOption);
}

private static MandatoryReplacer tsConfigCompilerOption(String optionName, String optionValue, Indentation indentation) {
String compilerOption = indentation.times(2) + "\"%s\": \"%s\",".formatted(optionName, optionValue);
return new MandatoryReplacer(lineAfterRegex("\"compilerOptions\":"), compilerOption);
}

private Consumer<JHipsterModuleBuilder> patchVitestConfig(JHipsterModuleProperties properties) {
//@formatter:off
return moduleBuilder -> moduleBuilder
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react';
import './HomePage.css';

import JHipsterLiteNeonBlue from '@assets/JHipster-Lite-neon-blue.png';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react';
import { render } from '@testing-library/react';
import { describe, it } from 'vitest';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react';
import LoginForm from '@/login/primary/loginForm';

import './HomePage.css';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button } from '@nextui-org/react';
import { createContext, useCallback, useMemo, useState } from 'react';
import React, { createContext, useCallback, useMemo, useState } from 'react';

import LoginModal from '@/login/primary/loginModal';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import React from 'react';

export const EyeFilledIcon = (props: { className: string }) => (
<svg aria-hidden="true" fill="none" focusable="false" height="1em" viewBox="0 0 24 24" width="1em" {...props}>
<path
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import React from 'react';

export const EyeSlashFilledIcon = (props: { className: string }) => (
<svg aria-hidden="true" fill="none" focusable="false" height="1em" viewBox="0 0 24 24" width="1em" {...props}>
<path
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Input, Modal, ModalBody, ModalContent, ModalHeader, Spacer } from '@nextui-org/react';
import { useCallback, useContext, useState } from 'react';
import React, { useCallback, useContext, useState } from 'react';
import { useForm } from 'react-hook-form';

import { EyeFilledIcon } from './EyeFilledIcon';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react';
import axios from 'axios';
import { describe, expect, it, vi } from 'vitest';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react';
import { act, fireEvent, render } from '@testing-library/react';
import axios from 'axios';
import { describe, expect, it } from 'vitest';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export default typescript.config(
},
},
rules: {
'react/react-in-jsx-scope': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/await-thenable': 'off',
'@typescript-eslint/consistent-type-imports': 'error',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "@tsconfig/vite-react/tsconfig.json",
"compilerOptions": {
"jsx": "react",
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"composite": false,
Expand Down
Loading