| 849 | } |
| 850 | |
| 851 | function setupEslint(root: string, isTs: boolean) { |
| 852 | // renovate: datasource=npm depName=@eslint/js |
| 853 | const eslintJsVersion = '10.0.1' |
| 854 | // renovate: datasource=npm depName=eslint |
| 855 | const eslintVersion = '10.6.0' |
| 856 | // renovate: datasource=npm depName=eslint-plugin-react-hooks |
| 857 | const eslintPluginReactHooksVersion = '7.1.1' |
| 858 | // renovate: datasource=npm depName=eslint-plugin-react-refresh |
| 859 | const eslintPluginReactRefreshVersion = '0.5.3' |
| 860 | // renovate: datasource=npm depName=globals |
| 861 | const globalsVersion = '17.7.0' |
| 862 | // renovate: datasource=npm depName=typescript-eslint |
| 863 | const typescriptEslintVersion = '8.62.0' |
| 864 | |
| 865 | const eslintConfigForTS = /* js */ `import js from '@eslint/js' |
| 866 | import globals from 'globals' |
| 867 | import reactHooks from 'eslint-plugin-react-hooks' |
| 868 | import reactRefresh from 'eslint-plugin-react-refresh' |
| 869 | import tseslint from 'typescript-eslint' |
| 870 | import { defineConfig, globalIgnores } from 'eslint/config' |
| 871 | |
| 872 | export default defineConfig([ |
| 873 | globalIgnores(['dist']), |
| 874 | { |
| 875 | files: ['**/*.{ts,tsx}'], |
| 876 | extends: [ |
| 877 | js.configs.recommended, |
| 878 | tseslint.configs.recommended, |
| 879 | reactHooks.configs.flat.recommended, |
| 880 | reactRefresh.configs.vite, |
| 881 | ], |
| 882 | languageOptions: { |
| 883 | globals: globals.browser, |
| 884 | }, |
| 885 | }, |
| 886 | ]) |
| 887 | ` |
| 888 | const eslintConfigForJS = /* js */ `import js from '@eslint/js' |
| 889 | import globals from 'globals' |
| 890 | import reactHooks from 'eslint-plugin-react-hooks' |
| 891 | import reactRefresh from 'eslint-plugin-react-refresh' |
| 892 | import { defineConfig, globalIgnores } from 'eslint/config' |
| 893 | |
| 894 | export default defineConfig([ |
| 895 | globalIgnores(['dist']), |
| 896 | { |
| 897 | files: ['**/*.{js,jsx}'], |
| 898 | extends: [ |
| 899 | js.configs.recommended, |
| 900 | reactHooks.configs.flat.recommended, |
| 901 | reactRefresh.configs.vite, |
| 902 | ], |
| 903 | languageOptions: { |
| 904 | globals: globals.browser, |
| 905 | parserOptions: { ecmaFeatures: { jsx: true } }, |
| 906 | }, |
| 907 | }, |
| 908 | ]) |