-
Notifications
You must be signed in to change notification settings - Fork 390
Lint: Add tailwind linter #5984
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3df7559
deps: add eslint-plugin-tailwindcss (beta for v4 support)
DrJKL 20d120b
deps: remove bad types transitive dep
DrJKL 2dac27e
lint: Enable tailwind recommended lint rules
DrJKL 6b83a9f
cleanup: Extract common options
DrJKL 956c678
cleanup: Allow for linting some more of the root files
DrJKL 2fe7e87
lint: Fix fixable tailwind warnings
DrJKL fff429c
lint: turn off no-custom-classname until we can finish standardizing
DrJKL ebef9b5
ugh: Something is different in the two environments. Need to figure t…
DrJKL 327949b
test: Fix test that was very dependent on classname
DrJKL 795f962
[automated] Apply ESLint and Prettier fixes
actions-user File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,36 +4,67 @@ import pluginI18n from '@intlify/eslint-plugin-vue-i18n' | |
import { importX } from 'eslint-plugin-import-x' | ||
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended' | ||
import storybook from 'eslint-plugin-storybook' | ||
import tailwind from 'eslint-plugin-tailwindcss' | ||
import unusedImports from 'eslint-plugin-unused-imports' | ||
import pluginVue from 'eslint-plugin-vue' | ||
import { defineConfig } from 'eslint/config' | ||
import globals from 'globals' | ||
import tseslint from 'typescript-eslint' | ||
import { | ||
configs as tseslintConfigs, | ||
parser as tseslintParser | ||
} from 'typescript-eslint' | ||
import vueParser from 'vue-eslint-parser' | ||
|
||
const extraFileExtensions = ['.vue'] | ||
|
||
const commonGlobals = { | ||
...globals.browser, | ||
__COMFYUI_FRONTEND_VERSION__: 'readonly' | ||
} as const | ||
|
||
const settings = { | ||
'import/resolver': { | ||
typescript: true, | ||
node: true | ||
}, | ||
tailwindcss: { | ||
config: `${import.meta.dirname}/packages/design-system/src/css/style.css`, | ||
functions: ['cn', 'clsx', 'tw'] | ||
} | ||
} as const | ||
|
||
const commonParserOptions = { | ||
parser: tseslintParser, | ||
projectService: true, | ||
tsConfigRootDir: import.meta.dirname, | ||
ecmaVersion: 2020, | ||
sourceType: 'module', | ||
extraFileExtensions | ||
} as const | ||
|
||
export default defineConfig([ | ||
{ | ||
ignores: [ | ||
'src/scripts/*', | ||
'src/extensions/core/*', | ||
'src/types/vue-shim.d.ts', | ||
'.i18nrc.cjs', | ||
'components.d.ts', | ||
'lint-staged.config.js', | ||
'vitest.setup.ts', | ||
'**/vite.config.*.timestamp*', | ||
'**/vitest.config.*.timestamp*', | ||
'packages/registry-types/src/comfyRegistryTypes.ts', | ||
'src/extensions/core/*', | ||
'src/scripts/*', | ||
'src/types/generatedManagerTypes.ts', | ||
'**/vite.config.*.timestamp*', | ||
'**/vitest.config.*.timestamp*' | ||
'src/types/vue-shim.d.ts' | ||
] | ||
}, | ||
{ | ||
files: ['./**/*.{ts,mts}'], | ||
settings, | ||
languageOptions: { | ||
globals: { | ||
...globals.browser, | ||
__COMFYUI_FRONTEND_VERSION__: 'readonly' | ||
}, | ||
globals: commonGlobals, | ||
parserOptions: { | ||
parser: tseslint.parser, | ||
...commonParserOptions, | ||
projectService: { | ||
allowDefaultProject: [ | ||
'vite.config.mts', | ||
|
@@ -42,47 +73,26 @@ export default defineConfig([ | |
'playwright.config.ts', | ||
'playwright.i18n.config.ts' | ||
] | ||
}, | ||
tsConfigRootDir: import.meta.dirname, | ||
ecmaVersion: 2020, | ||
sourceType: 'module', | ||
extraFileExtensions | ||
} | ||
}, | ||
settings: { | ||
'import/resolver': { | ||
typescript: true, | ||
node: true | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
files: ['./**/*.vue'], | ||
settings, | ||
languageOptions: { | ||
globals: { | ||
...globals.browser, | ||
__COMFYUI_FRONTEND_VERSION__: 'readonly' | ||
}, | ||
globals: commonGlobals, | ||
parser: vueParser, | ||
parserOptions: { | ||
parser: tseslint.parser, | ||
projectService: true, | ||
tsConfigRootDir: import.meta.dirname, | ||
ecmaVersion: 2020, | ||
sourceType: 'module', | ||
extraFileExtensions | ||
} | ||
}, | ||
settings: { | ||
'import/resolver': { | ||
typescript: true, | ||
node: true | ||
} | ||
parserOptions: commonParserOptions | ||
} | ||
}, | ||
pluginJs.configs.recommended, | ||
// eslint-disable-next-line import-x/no-named-as-default-member | ||
tseslint.configs.recommended, | ||
|
||
tseslintConfigs.recommended, | ||
// Difference in typecheck on CI vs Local | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore Bad types in the plugin | ||
tailwind.configs['flat/recommended'], | ||
pluginVue.configs['flat/recommended'], | ||
eslintPluginPrettierRecommended, | ||
storybook.configs['flat/recommended'], | ||
|
@@ -114,6 +124,7 @@ export default defineConfig([ | |
'import-x/no-relative-packages': 'error', | ||
'unused-imports/no-unused-imports': 'error', | ||
'no-console': ['error', { allow: ['warn', 'error'] }], | ||
'tailwindcss/no-custom-classname': 'off', // TODO: fix | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no-action: Didn't want to eat the elephant all at once? 😂 |
||
'vue/no-v-html': 'off', | ||
// Enforce dark-theme: instead of dark: prefix | ||
'vue/no-restricted-class': ['error', '/^dark:/'], | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
src/components/bottomPanel/tabs/shortcuts/EssentialsPanel.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
non-blocker: CI causes the issue?