Skip to content

Conversation

@MrZyr0
Copy link

@MrZyr0 MrZyr0 commented Dec 22, 2025

Add ESLint Flat Config Support with backward compatibility

Hey!
I would like to use this awesome plugin in my project, which uses ESLint 9+ with FlatConfig, so I suggest adding FlatConfig support to the plugin while maintaining the current functionality for those who still use .eslintrc.

What's New

ESLint 9 made flat config the default, so I've updated the plugin to work with both the new and old config formats. The plugin now exports two configs:

  • flat/recommended for the new flat config (ESLint 9+)
  • legacy-recommended for traditional .eslintrc setups

Usage

For ESLint 9+ (Flat Config)

import sql from 'eslint-plugin-sql';

export default [
  sql.configs['flat/recommended']
];

For ESLint 8 (.eslintrc)

{
  "extends": ["plugin:sql/legacy-recommended"]
}

What Changed

  • Build: Switched from tsc to tsup for dual CJS/ESM output
  • Plugin structure: Added proper meta object with name and version
  • Configs: Created separate configs for flat and legacy formats
  • Tests: Added comprehensive tests for both config formats and CJS/ESM builds
  • Docs: Updated README with clear examples for both approaches

Testing

All tests pass, including new ones that verify:

  • CJS and ESM builds work correctly
  • Plugin exports the right structure
  • Configs apply properly in real ESLint instances
  • Rules work the same way in both formats

Backward Compatibility

It seems that the plugin did not previously export any predefined configurations, so there are zero breaking changes. If you're using the plugin today, it'll keep working exactly as before.

This is my first contribution to an eslint community plugin and I am new to this field, so please feel free to give me feedbacks ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant