Skip to content

Commit

Permalink
Merge c46636a into d941000
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasoppermann committed Jul 9, 2024
2 parents d941000 + c46636a commit 49c8342
Show file tree
Hide file tree
Showing 5 changed files with 355 additions and 643 deletions.
166 changes: 0 additions & 166 deletions .eslintrc.js

This file was deleted.

206 changes: 206 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
import * as parser from '@typescript-eslint/parser'
import {fixupPluginRules} from '@eslint/compat'
import eslintConfigPrettier from 'eslint-config-prettier'
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
import jsxA11y from 'eslint-plugin-jsx-a11y'
import eslintPluginReactHooks from 'eslint-plugin-react-hooks'
import eslintPluginReact from 'eslint-plugin-react'
import eslintPluginGithub from 'eslint-plugin-github'
import eslintPluginTypescript from 'typescript-eslint'
// import {plugins} from 'eslint-plugin-react/configs/all'
// "eslint-plugin-primer-react": "^5.3.0",
// "eslint-import-resolver-typescript": "3.6",

export default [
// 'plugin:github/recommended',
// 'plugin:github/browser',
// {
// plugins: {
// react: eslintPluginReact,
// 'react-hooks': fixupPluginRules(eslintPluginReactHooks),
// },
// rules: {
// ...eslintPluginGithub.rules
// },
// },
jsxA11y.flatConfigs.recommended,
{
plugins: {
react: eslintPluginReact,
'react-hooks': fixupPluginRules(eslintPluginReactHooks),
},
rules: {
...eslintPluginReactHooks.configs.recommended.rules,
...eslintPluginReact.configs['jsx-runtime'].rules,
},
},
eslintPluginPrettierRecommended,
eslintConfigPrettier,
{
ignores: ['node_modules', 'coverage/**', 'docs/**', 'dist/**/*', 'CHANGELOG.md', 'src/@types/'],
},
{
languageOptions: {
parser,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
globals: {
__DEV__: 'readonly',
browser: true,
commonjs: true,
es6: true,
jest: true,
node: true,
},
},
ignores: ['README.md'],
settings: {
react: {
version: 'detect',
},
'import/resolver': {
typescript: {}, // this loads <rootdir>/tsconfig.json to eslint
},
},
// rules which apply to JS, TS, etc.
rules: {
'filenames/match-regex': 0,
'eslint-comments/no-unused-disable': 0,
'react/prop-types': 0,
'react/display-name': 0,
'react-hooks/exhaustive-deps': 'error',
'jsx-a11y/label-has-for': [
2,
{
components: [],
},
],
camelcase: [
'error',
{
allow: [
'light_high_contrast',
'light_colorblind',
'light_tritanopia',
'dark_dimmed',
'dark_high_contrast',
'dark_colorblind',
'dark_tritanopia',
],
},
],
},
},
// rules which apply only to JS
{
files: ['**/*.{js,jsx}'],
rules: {
'eslint-comments/no-use': 0,
'import/no-namespace': 0,
'no-shadow': 0,
'import/no-commonjs': 0,
'import/no-nodejs-modules': 0,
'no-unused-vars': [
'error',
{
ignoreRestSiblings: true,
},
],
},
},
{
plugins: {
eslintPluginTypescript: eslintPluginTypescript.configs.recommended,
},
files: ['**/*.{ts,tsx}'],
},
// rules which apply only to TS
{
languageOptions: {
parserOptions: {
project: 'tsconfig.json',
},
},
files: ['**/*.{ts,tsx}'],
// extends: ['plugin:@typescript-eslint/recommended', 'prettier'],
rules: {
'no-shadow': 'off',
'@typescript-eslint/no-shadow': 'error',
'@typescript-eslint/no-explicit-any': 2,
'@typescript-eslint/no-unnecessary-condition': 2,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/consistent-type-imports': 'warn',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
},
},
// rules which apply only to tests files
{
files: ['**/*.test.{ts,tsx,js,jsx}'],
rules: {
'i18n-text/no-en': 0,
},
},
// // rules which apply only to TS scripts
// {
// files: ['scripts/**/*.ts', 'src/**/*.ts'],
// rules: {
// 'import/no-nodejs-modules': [
// 'error',
// {
// allow: ['path', 'fs', 'fs/promises'],
// },
// ],
// 'i18n-text/no-en': 0,
// },
// },
// // rules which apply only to Markdown
// {
// files: ['**/*.{md,mdx}'],
// extends: ['plugin:mdx/recommended'],
// settings: {
// 'mdx/code-blocks': true,
// },
// rules: {
// 'prettier/prettier': 0,
// },
// },
// rules which apply only to Markdown code blocks
{
files: ['**/*.{md,mdx}/**'],
languageOptions: {
parserOptions: {
project: false,
},
},
rules: {
camelcase: 0,
'import/no-unresolved': 0,
'no-constant-condition': 0,
'no-console': 0,
'no-empty-pattern': 0,
'no-unused-vars': 0,
'no-undef': 0,
'react/no-unescaped-entities': 0,
'react/react-in-jsx-scope': 0,
'react/jsx-no-undef': 0,
'react/jsx-key': 0,
'react/jsx-no-comment-textnodes': 0,
'i18n-text/no-en': 0,
'import/no-anonymous-default-export': 0,
'import/extensions': 0,
'prettier/prettier': 0,
'@typescript-eslint/no-unnecessary-condition': 0,
'@typescript-eslint/no-unused-vars': 0,
'no-redeclare': 0,
},
},
]
2 changes: 0 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
// this is no html literal
// eslint-disable-next-line github/unescaped-html-literal
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, {prefix: '<rootDir>/'}),
// eslint-disable-next-line github/unescaped-html-literal
testPathIgnorePatterns: ['<rootDir>/e2e/'],
}
Loading

0 comments on commit 49c8342

Please sign in to comment.