Skip to content

Commit

Permalink
React/ESLint: enable react/react-in-jsx-scope
Browse files Browse the repository at this point in the history
  • Loading branch information
qmonmert committed Dec 2, 2024
1 parent d64360f commit 008c14d
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 2 deletions.
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,3 +1,4 @@
import React from 'react';
import { Button } from '@nextui-org/react';
import { createContext, useCallback, useMemo, useState } from 'react';

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,3 +1,4 @@
import React from 'react';
import { Button, Input, Modal, ModalBody, ModalContent, ModalHeader, Spacer } from '@nextui-org/react';
import { useCallback, useContext, useState } from 'react';
import { useForm } from 'react-hook-form';
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

0 comments on commit 008c14d

Please sign in to comment.