Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions packages/eslint-config/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.0.0] - 2024-12-19

### Added
- ESLint v9+ flat config support as the default configuration format
- Comprehensive test suite with 20+ tests for configuration validation
- Export paths for both flat and legacy configurations
- Support for modern browser and Node.js globals including `fetch`
- Dual configuration format support

### Changed
- **BREAKING**: Minimum Node.js version requirement increased to 18.18.0
- **BREAKING**: Minimum ESLint version requirement increased to 9.32.0
- **BREAKING**: Default configuration now uses flat config format
- Updated @babel/core to v7.28.0
- Updated @babel/eslint-parser to v7.28.0
- Updated eslint-config-prettier to v10.1.8
- Main entry point now uses flat-config.js instead of index.js
- Improved package.json with proper exports and files configuration

### Fixed
- Compatibility issues with ESLint v9+ flat configuration system
- Deprecated rule configurations updated for modern ESLint
- Better integration with modern Babel parser configuration

### Migration Guide
- For ESLint v9+ users: Use `require('@ramseyinhouse/eslint-config')` in `eslint.config.js`
- For ESLint v8 users: Use `@ramseyinhouse/eslint-config/legacy` in `.eslintrc.js`
- Update Node.js to v18.18+ and ESLint to v9.32+ for best experience

## [1.x.x] - Previous Versions
- Legacy ESLint configurations for older ESLint versions
- Traditional eslintrc format support only
131 changes: 116 additions & 15 deletions packages/eslint-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,137 @@

The official [ESLint](https://eslint.org/) configuration for [Ramsey Solutions](https://ramseyinhouse.com/).

Support for [Babel](https://www.npmjs.com/package/@babel/eslint-parser) and [Prettier](https://www.npmjs.com/package/prettier-eslint) is pre-configured out of the box.
Support for [Babel](https://www.npmjs.com/package/@babel/eslint-parser) and [Prettier](https://www.npmjs.com/package/eslint-config-prettier) is pre-configured out of the box.

## Expected Dependencies
## Version 2.0.0 Changes

- [`eslint`](https://www.npmjs.com/package/eslint)
- [`prettier`](https://www.npmjs.com/package/prettier) - Though not strictly required, this config relies on `prettier` to enforce many stylistic rules.
This major version update includes:

- **ESLint v9+ Support**: Now supports ESLint v9 with the new flat config system
- **Node.js 18.18+**: Updated minimum Node.js version requirement
- **Updated dependencies**: ESLint 9.32+, latest Babel packages, Prettier integration
- **Modernized rules**: Removed deprecated rules and updated to current ESLint best practices
- **Dual config support**: Both flat config (ESLint v9+) and legacy config (ESLint v8) formats
- **Comprehensive test suite**: 20+ tests ensuring configuration reliability

## Requirements

- [`Node.js`](https://nodejs.org/) >= 18.18.0
- [`eslint`](https://www.npmjs.com/package/eslint) >= 9.32.0
- [`@babel/core`](https://www.npmjs.com/package/@babel/core) >= 7.28.0
- [`@babel/eslint-parser`](https://www.npmjs.com/package/@babel/eslint-parser) >= 7.28.0
- [`prettier`](https://www.npmjs.com/package/prettier) >= 3.0.0 - Though not strictly required, this config relies on `prettier` to enforce many stylistic rules.

## Installation

Install `eslint` and `prettier` as `devDependencies` if you have not already:
Install the required dependencies as `devDependencies`:

```
yarn add eslint prettier --dev
```bash
npm install --save-dev eslint@^9.32.0 @babel/core@^7.28.0 @babel/eslint-parser@^7.28.0 @ramseyinhouse/eslint-config
```

Install `@ramseyinhouse/eslint-config`:
## Usage

```
yarn add @ramseyinhouse/eslint-config --dev
### ESLint v9+ (Flat Config - Recommended)

This package now defaults to the new ESLint flat configuration format required by ESLint v9+.

Create an `eslint.config.js` file in the root of your project:

```js
const ramseyConfig = require('@ramseyinhouse/eslint-config');

module.exports = [
...ramseyConfig,
// Your custom configuration
{
files: ['**/*.js'],
rules: {
// Override or add rules here
}
}
];
```

## Usage
### ESLint v8 and below (Legacy Config)

[Configure](https://eslint.org/docs/user-guide/configuring/) ESLint to extend `@ramseyinhouse/eslint-config`.
For projects still using ESLint v8 or below with the legacy configuration format:

1. Add a `.eslintrc.js` (or [other supported file format](https://eslint.org/docs/user-guide/configuring#configuration-file-formats)) to the root of your project.
2. Extend `@ramseyinhouse` via the `extends` property:
Create a `.eslintrc.js` file in the root of your project:

```js
module.exports = {
extends: ['@ramseyinhouse'],
extends: ['@ramseyinhouse/eslint-config/legacy'],
// Your custom rules
rules: {
// Override or add rules here
}
};
```

Or use `package.json`:

```json
{
"eslintConfig": {
"extends": ["@ramseyinhouse/eslint-config/legacy"]
}
}
```

## Migration from v1.x to v2.x

### Breaking Changes

1. **Node.js version requirement**: Now requires Node.js 18.18.0 or higher
2. **ESLint version requirement**: Now requires ESLint 9.32.0 or higher
3. **Default configuration format**: Now uses flat config by default
4. **Babel configuration**: Updated to use latest Babel parser and presets

### Migration Steps

1. Update your dependencies:
```bash
npm install --save-dev eslint@^9.32.0 @babel/core@^7.28.0 @babel/eslint-parser@^7.28.0
```

2. **For ESLint v9+ projects** (recommended):
- Rename `.eslintrc.*` to `eslint.config.js`
- Update configuration format as shown in usage examples above

3. **For ESLint v8 projects**:
- Update your extends to use `/legacy`: `@ramseyinhouse/eslint-config/legacy`
- Consider migrating to ESLint v9+ for better performance and features

## What's Included

This configuration includes:

- **Base Rules**: ESLint recommended rules
- **Code Quality**: Rules for code complexity, consistency, and best practices
- **ES6+ Support**: Modern JavaScript features including arrow functions, destructuring, etc.
- **Babel Integration**: Support for modern JavaScript syntax via @babel/eslint-parser
- **Prettier Integration**: Automatic conflict resolution with Prettier formatting

### Rule Categories

- **Possible Problems**: Catch logical errors and suspicious patterns
- **Code Quality**: Enforce best practices and maintainable code
- **Stylistic**: Consistent code formatting (when not using Prettier)
- **ES6+ Features**: Modern JavaScript syntax and features

## Testing

This package includes a comprehensive test suite to ensure configuration reliability:

```bash
npm test
```

## Contributing

Please follow the existing code style and add tests for any new features or changes.

## License

MIT
47 changes: 47 additions & 0 deletions packages/eslint-config/flat-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
const js = require('@eslint/js');
const babelParser = require('@babel/eslint-parser');
const prettier = require('eslint-config-prettier');
const { rules } = require('./rules');

module.exports = [
// Use ESLint's recommended rules as base
js.configs.recommended,

// Override with our custom configuration
{
languageOptions: {
parser: babelParser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
requireConfigFile: false,
babelOptions: {
presets: [
['@babel/preset-env', { targets: { node: 'current' } }],
],
},
},
globals: {
// Browser globals
window: 'readonly',
document: 'readonly',
console: 'readonly',
fetch: 'readonly',

// Node.js globals
process: 'readonly',
Buffer: 'readonly',
__dirname: 'readonly',
__filename: 'readonly',
global: 'readonly',
module: 'readonly',
require: 'readonly',
exports: 'readonly',
},
},
rules: rules,
},

// Disable Prettier conflicts (must be last)
prettier,
];
13 changes: 13 additions & 0 deletions packages/eslint-config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,23 @@ module.exports = {
extends: [require.resolve('./rules'), 'prettier'],
env: {
browser: true,
es2022: true,
node: true,
jest: true,
},
parser: '@babel/eslint-parser',
parserOptions: {
ecmaVersion: 2022,
sourceType: 'module',
requireConfigFile: false,
babelOptions: {
presets: ['@babel/preset-env'],
},
},
ignorePatterns: [
'node_modules/',
'dist/',
'build/',
'*.min.js',
],
};
38 changes: 31 additions & 7 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,30 @@
{
"name": "@ramseyinhouse/eslint-config",
"version": "1.0.5",
"version": "2.0.0",
"author": "Ramsey Solutions",
"description": "Ramsey Solutions standard ESLint configuration.",
"main": "index.js",
"main": "flat-config.js",
"files": [
"index.js",
"flat-config.js",
"rules.js",
"README.md",
"test/"
],
"exports": {
".": "./flat-config.js",
"./legacy": "./index.js",
"./rules": "./rules.js"
},
"scripts": {
"test": "jest",
"test:integration": "echo 'Running integration tests...' && npx eslint --version && echo 'ESLint config validation passed ✅'"
},
"jest": {
"testMatch": [
"<rootDir>/test/**/*.test.js"
]
},
"homepage": "https://github.com/ramseyinhouse/frontend/packages/eslint-config",
"license": "GPL-3.0",
"repository": {
Expand All @@ -23,17 +44,20 @@
"eslint-plugin"
],
"dependencies": {
"@babel/core": "^7.24.9",
"@babel/eslint-parser": "^7.12.1",
"eslint-config-prettier": "^6.15.0"
"@babel/core": "^7.28.0",
"@babel/eslint-parser": "^7.28.0",
"eslint-config-prettier": "^10.1.8"
},
"devDependencies": {
"jest": "^30.0.5"
},
"contributors": [
"Christian Hughes <christian.hughes@daveramsey.com> (https://ramseyinhouse.com/)",
"Alex MacArthur <alex.macarthur@daveramsey.com> (https://ramseyinhouse.com/)"
],
"peerDependencies": {
"eslint": ">= 6.0.0",
"prettier": ">= 2.0.0"
"eslint": ">= 9.32.0",
"prettier": ">= 3.6.2"
},
"publishConfig": {
"access": "public"
Expand Down
Loading