patronage / bubs-next

Headless Wordpress + Next.js Project scaffolding
https://bubs-next.vercel.app
MIT License
37 stars 10 forks source link

Prettier Refactor to Top Level #305

Open ccorda opened 2 months ago

ccorda commented 2 months ago

Lately we've had more success when using prettier to have a single config at the top then applies consistent formatting in various subfolders.

Also we've been switchiing to *.config.js instead of various JSON formats.

ccorda commented 2 months ago

One note for the future, I went to update to eslint 9 and the new flat config, but it seems that Next isn't compatible yet: https://github.com/vercel/next.js/issues/64409

When it is, we'll want something like this:

// eslint.config.js
const next = require('@next/eslint-plugin-next');
const prettier = require('eslint-config-prettier');
const react = require('eslint-plugin-react');
const reactRecommended = require('eslint-plugin-react/configs/recommended');
const globals = require('globals');

module.exports = [
  // {
  //   files: ['src/**/*.{js,jsx,ts,tsx}'],
  //   ...reactRecommended,
  // },
  // {
  //   files: ['src/**/*.{js,jsx,ts,tsx}'],
  //   languageOptions: {
  //     globals: {
  //       ...globals.serviceworker,
  //       ...globals.browser,
  //     },
  //   },
  // },
  {
    files: ['src/**/*.{js,jsx,ts,tsx}'],
    ...next.configs.recommended,
  },
  {
    files: ['src/**/*.{js,jsx,ts,tsx}'],
    ...prettier,
  },
];