nozomiishii / configs

🍱 Crucial Configs
MIT License
5 stars 0 forks source link

flat config #637

Open nozomiishii opened 5 months ago

nozomiishii commented 5 months ago

作業

公式 Flat Config support 表 https://github.com/eslint/eslint/issues/18093

対応パッケージ

46

nozomiishii commented 5 months ago

久々にflat config試そうとしたが全然できん

nozomiishii commented 5 months ago

prettierはいける

// @ts-check
import { defineFlatConfig } from 'eslint-define-config';
import eslintConfigPrettier from 'eslint-config-prettier';

/**
 * eslint-config-prettier
 * {@link https://www.npmjs.com/package/eslint-config-prettier}
 */
export default defineFlatConfig([eslintConfigPrettier]);
nozomiishii commented 5 months ago

nextjsは無理

import { defineFlatConfig } from 'eslint-define-config';
import next from '@next/eslint-plugin-next';

/**
 * FIXME: @ts-checkすると死ぬ
 *
 * @next/eslint-plugin-next
 * {@link https://www.npmjs.com/package/@next/eslint-plugin-next}
 */
export default defineFlatConfig([
  {
    files: ['**/*.ts', '**/*.tsx'],
    plugins: {
      '@next/next': next,
    },
    rules: {
      ...next.configs.recommended.rules,
      ...next.configs['core-web-vitals'].rules,
    },
  },
]);
nozomiishii commented 5 months ago

tailwindはdefineFlatConfigではうまくいかなかったけど import("eslint").Linter.FlatConfig[]なら型安全

// @ts-check
import tailwind from 'eslint-plugin-tailwindcss';

/**
 * eslint-plugin-tailwindcss
 * {@link https://www.npmjs.com/package/eslint-plugin-tailwindcss}
 *
 * @type {import("eslint").Linter.FlatConfig[]}
 */
export default [...tailwind.configs['flat/recommended']];
nozomiishii commented 5 months ago

@tanstack/eslint-plugin-queryだめ

nozomiishii commented 5 months ago

reactもダメだな

nozomiishii commented 5 months ago

延期

nozomiishii commented 5 months ago

--ignore-path廃止されたから gitinoreはこれ https://github.com/antfu/eslint-config-flat-gitignore

nozomiishii commented 5 months ago

このcliで作ることもできるのかー! https://github.com/eslint/create-config

nozomiishii commented 1 month ago

Nextjsいけるかも

https://github.com/vercel/next.js/issues/64409#issuecomment-2254461765

nozomiishii commented 1 month ago

こっちのreactのeslintも良さそう https://www.npmjs.com/package/@eslint-react/eslint-plugin

https://github.com/facebook/react/issues/28313#issuecomment-2379133367