-
-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support flat config #330
feat: support flat config #330
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for flat config, ecmaFeatures
option is not added. Because the parser options should be specified by the user. especially, jsx: true
should be supported by plugins like eslint-plugin-react
, as mentioned in the eslint documentation.
https://eslint.org/docs/latest/use/configure/language-options#specifying-parser-options
BTW, ecmaFeatures
for flat config built-in on the plugin side will cause eslint to output an error as shown below, so we cannot set them built-in:
Error: Key "languageOptions": Unexpected key "ecmaFeatures" found.
at ObjectSchema.validate (/path/to/oss/tailwind/eslint-plugin-tailwindcss/tests/integrations/flat-config/node_modules/@humanwhocodes/object-schema/src/object-schema.js:287:23)
at /path/to/oss/tailwind/eslint-plugin-tailwindcss/tests/integrations/flat-config/node_modules/@humanwhocodes/object-schema/src/object-schema.js:239:18
at Array.reduce (<anonymous>)
at ObjectSchema.merge (/path/to/oss/tailwind/eslint-plugin-tailwindcss/tests/integrations/flat-config/node_modules/@humanwhocodes/object-schema/src/object-schema.js:237:24)
at /path/to/oss/tailwind/eslint-plugin-tailwindcss/tests/integrations/flat-config/node_modules/@humanwhocodes/config-array/api.js:935:42
at Array.reduce (<anonymous>)
at FlatConfigArray.getConfig (/path/to/oss/tailwind/eslint-plugin-tailwindcss/tests/integrations/flat-config/node_modules/@humanwhocodes/config-array/api.js:934:39)
at FlatConfigArray.isFileIgnored (/path/to/oss/tailwind/eslint-plugin-tailwindcss/tests/integrations/flat-config/node_modules/@humanwhocodes/config-array/api.js:962:15)
at /path/to/oss/tailwind/eslint-plugin-tailwindcss/tests/integrations/flat-config/node_modules/eslint/lib/eslint/eslint-helpers.js:504:38
at Array.forEach (<anonymous>)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren’t ecmaFeatures
supported in languageOptions.parserOptions
?
{
+ languageOptions: {
+ parserOptions: {
+ ecmaFeatures: {
+ jsx: true,
+ },
+ },
+ },
plugins: {
get tailwindcss() {
return require('../index');
},
},
},
ref: https://eslint.org/docs/latest/use/configure/configuration-files-new#configuration-objects
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
oh, I've apparently mis-read the config docs, and I found that it is possible with flat config.
@@ -9,6 +9,7 @@ const rules = require('./rules'); | |||
|
|||
module.exports = [ | |||
{ | |||
name: 'tailwindcss:base', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
about name
, see the here
We can check flat config with eslint config inspector
Is this close to being merged in and part of a new release? If there is any work that still needs to be done, I'd be willing to jump on it. I'm transitioning my projects to eslint v9 and I'll gladly help if that means this plugin can support v9 sooner. |
…lwindcss into feat/flat-config
Hi @kazupon, I also published a new beta release which includes your changes: Do you understand why the tests are failing in the CICD ? I get an error, also on my local machine:
|
@francoismassart eslint-plugin-tailwindcss/tests/lib/rules/no-custom-classname.js Lines 436 to 446 in 4d04a96
I'll check to see if my changes broke any |
Hi! @francoismassart And ESLints were outputting API compatibility warnings. |
Great, thank you @kazupon, I published a new beta version: |
@francoismassart |
support flat config
Description
Fixes #280
This PR supports flat config.
It is also compatible with existing configs.
Type of change
How Has This Been Tested?
tests/integrations/flat-config
)tests/integrations/legacy-config
)Test Configuration:
Checklist: