DocumentationGetting StartedJavaScript with Babel

Getting Started with JavaScript + Babel

Install

Terminal
npm install --save-dev @babel/core @babel/eslint-parser @babel/preset-env @babel/preset-react @eslint-react/eslint-plugin

Setup

eslint.config.js
import eslintJs from "@eslint/js";
import eslintReact from "@eslint-react/eslint-plugin";
import babelEslintParser from "@babel/eslint-parser";
import globals from "globals";
 
export default [
  {
    files: ["**/*.js", "**/*.jsx"],
    ...eslintJs.configs.recommended,
    languageOptions: {
      globals: {
        ...globals.browser,
      },
      parser: babelEslintParser,
      parserOptions: {
        requireConfigFile: false,
        babelOptions: {
          babelrc: false,
          configFile: false,
          presets: ["@babel/preset-env", "@babel/preset-react"],
        },
      },
    },
  },
  {
    files: ["**/*.js", "**/*.jsx"],
    rules: {
      // Put rules you want to override here
      "@eslint-react/prefer-shorthand-boolean": "warn",
    },
  },
];