This repository contains shared configuration files for ESLint, Prettier, and TypeScript, designed to be used across multiple projects. The configurations are published on npm for easy integration.
.github: GitHub configuration files__tests__: Contains scripts to validate ESLint configurations.apps: Example applications to demonstrate the use of the configurations.next: Example Next.js application.react: Example React application.
packages: Contains the shared configuration packages.eslint: ESLint configuration files (@marshallku/eslint-config).prettier: Prettier configuration files (@marshallku/prettier-config).typescript: TypeScript configuration files (@marshallku/typescript-config).
You can install each configuration package via npm.
Install the ESLint configuration:
npm i -D @marshallku/eslint-configThen, create or update your .eslintrc.cjs file to extend the installed configuration:
require("@marshallku/eslint-config/patch");
/** @type {import("eslint").Linter.Config} */
module.exports = {
env: { browser: true, es2020: true },
extends: ["@marshallku/eslint-config", "@marshallku/eslint-config/mixins/react"],
settings: {
react: {
version: "18.2",
},
},
parserOptions: {
project: true,
tsconfigRootDir: __dirname,
},
};You have to import @marshallku/eslint-config/patch module before extending the configuration.
Also, please make sure to add version of React to the settings.react.version field, and set the parserOptions.project and parserOptions.tsconfigRootDir fields to enable TypeScript support.
Install the Prettier configuration:
npm i -D @marshallku/prettier-configThen, add prettier field to your package.json file:
{
"name": "my-package",
"version": "1.0.0",
"prettier": "@marshallku/prettier-config"
}Install the TypeScript configuration:
npm i -D @marshallku/typescript-configThen, create or update your tsconfig.json file to extend the installed configuration:
{
"extends": "@marshallku/typescript-config/react-library.json",
"compilerOptions": {
"target": "ES2020"
},
"include": ["src"]
}