A modern and opinionated ESLint configuration with TypeScript, JSX, CSS, and Markdown support.
Using npm:
npm install -D @echristian/eslint-config eslintUsing yarn:
yarn add -D @echristian/eslint-config eslintUsing pnpm:
pnpm add -D @echristian/eslint-config eslintCreate an eslint.config.js file in your project root:
import eslintConfig from "@echristian/eslint-config";
export default eslintConfig({
// Configuration options here
});The configuration function accepts an options object with the following structure:
interface ESLintConfigOptions {
// Glob patterns to ignore
ignores?: Array<string>;
// TypeScript configuration
typescript?: {
options?: {
typeChecked?: boolean; // defaults to true
};
};
// React configuration
react?: {
enabled?: boolean; // defaults to false
options?: {
typeChecked?: boolean; // defaults to true
};
};
// React Hooks configuration
reactHooks?: {
enabled: boolean; // defaults to false
};
// JSX configuration
jsx?: {
enabled?: boolean; // defaults to false
a11y?: boolean; // defaults to true
};
// Markdown configuration
markdown?: {
enabled?: boolean; // defaults to false
options?: {
language?: "commonmark" | "gfm"; // defaults to "gfm"
frontMatter?: "yaml" | "toml" | "json" | false; // defaults to false
};
};
// Prettier configuration
prettier?: {
experimentalOperatorPosition?: "start" | "end";
experimentalTernaries?: boolean;
semi?: boolean;
// More prettier config
};
// Package.json rules configuration
packageJson?: {
package?: boolean; // defaults to false
};
}import eslintConfig from "@echristian/eslint-config";
export default eslintConfig({
ignores: ["dist/"],
});import eslintConfig from "@echristian/eslint-config";
export default eslintConfig({
typescript: {
options: {
typeChecked: false,
},
},
});import eslintConfig from "@echristian/eslint-config";
export default eslintConfig({
react: {
enabled: true,
},
reactHooks: {
enabled: true,
},
jsx: {
enabled: true,
},
});import eslintConfig from "@echristian/eslint-config";
export default eslintConfig({
ignores: ["dist/", "build/"],
react: {
enabled: true,
},
reactHooks: {
enabled: true,
},
jsx: {
enabled: true,
},
css: {
enabled: true,
},
});import eslintConfig from "@echristian/eslint-config";
export default eslintConfig({
markdown: {
enabled: true,
options: {
language: "gfm", // GitHub Flavored Markdown
frontMatter: "yaml", // Enable YAML frontmatter support
},
},
});import eslintConfig from "@echristian/eslint-config";
export default eslintConfig({
ignores: ["dist/", "build/"],
react: {
enabled: true,
},
reactHooks: {
enabled: true,
},
jsx: {
enabled: true,
},
markdown: {
enabled: true,
options: {
language: "gfm",
frontMatter: "yaml",
},
},
});This config includes the following major dependencies:
@eslint/js: Core ESLint rules@eslint/json: JSON support@eslint/css: CSS support@eslint/markdown: Markdown supporttypescript-eslint: TypeScript support@stylistic/eslint-plugin: Style-related ruleseslint-plugin-unused-imports: Unused imports managementeslint-plugin-perfectionist: Additional best practiceseslint-plugin-prettier: Prettier integrationeslint-plugin-regexp: Regular expression lintingeslint-plugin-de-morgan: Logical expression optimizationeslint-plugin-package-json: Package.json validationeslint-plugin-react-hooks: React Hooks linting rules@eslint-react/eslint-plugin: React component linting
MIT - See LICENSE for more information.