@chanyuxi/eslint-waltz 1.3.1 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +240 -73
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -771,74 +771,6 @@ async function reactConfig(options = {}, scriptScope) {
771
771
  async function stylisticConfig(options = {}, scriptScope) {
772
772
  const eslintStylistic = await importStylisticPlugin();
773
773
  const ruleFiles = resolveFiles(options.files, getScriptFiles(scriptScope));
774
- // Directly use the generated recommendation rules
775
- const configs = eslintStylistic.configs.customize();
776
- // This will enable the following rules.
777
- // '@stylistic/array-bracket-spacing'
778
- // '@stylistic/arrow-parens'
779
- // '@stylistic/arrow-spacing'
780
- // '@stylistic/block-spacing'
781
- // '@stylistic/brace-style'
782
- // '@stylistic/comma-dangle'
783
- // '@stylistic/comma-spacing'
784
- // '@stylistic/comma-style'
785
- // '@stylistic/computed-property-spacing'
786
- // '@stylistic/dot-location'
787
- // '@stylistic/eol-last'
788
- // '@stylistic/generator-star-spacing'
789
- // '@stylistic/indent'
790
- // '@stylistic/indent-binary-ops'
791
- // '@stylistic/key-spacing'
792
- // '@stylistic/keyword-spacing'
793
- // '@stylistic/lines-between-class-members'
794
- // '@stylistic/max-statements-per-line'
795
- // '@stylistic/member-delimiter-style'
796
- // '@stylistic/multiline-ternary'
797
- // '@stylistic/new-parens'
798
- // '@stylistic/no-extra-parens'
799
- // '@stylistic/no-floating-decimal'
800
- // '@stylistic/no-mixed-operators'
801
- // '@stylistic/no-mixed-spaces-and-tabs'
802
- // '@stylistic/no-multi-spaces'
803
- // '@stylistic/no-multiple-empty-lines'
804
- // '@stylistic/no-tabs'
805
- // '@stylistic/no-trailing-spaces'
806
- // '@stylistic/no-whitespace-before-property'
807
- // '@stylistic/object-curly-spacing'
808
- // '@stylistic/operator-linebreak'
809
- // '@stylistic/padded-blocks'
810
- // '@stylistic/quote-props'
811
- // '@stylistic/quotes'
812
- // '@stylistic/rest-spread-spacing'
813
- // '@stylistic/semi'
814
- // '@stylistic/semi-spacing'
815
- // '@stylistic/space-before-blocks'
816
- // '@stylistic/space-before-function-paren'
817
- // '@stylistic/space-in-parens'
818
- // '@stylistic/space-infix-ops'
819
- // '@stylistic/space-unary-ops'
820
- // '@stylistic/spaced-comment'
821
- // '@stylistic/template-curly-spacing'
822
- // '@stylistic/template-tag-spacing'
823
- // '@stylistic/type-annotation-spacing'
824
- // '@stylistic/type-generic-spacing'
825
- // '@stylistic/type-named-tuple-spacing'
826
- // '@stylistic/wrap-iife'
827
- // '@stylistic/yield-star-spacing'
828
- // '@stylistic/jsx-closing-bracket-location'
829
- // '@stylistic/jsx-closing-tag-location'
830
- // '@stylistic/jsx-curly-brace-presence'
831
- // '@stylistic/jsx-curly-newline'
832
- // '@stylistic/jsx-curly-spacing'
833
- // '@stylistic/jsx-equals-spacing'
834
- // '@stylistic/jsx-first-prop-new-line'
835
- // '@stylistic/jsx-function-call-newline'
836
- // '@stylistic/jsx-indent-props'
837
- // '@stylistic/jsx-max-props-per-line'
838
- // '@stylistic/jsx-one-expression-per-line'
839
- // '@stylistic/jsx-quotes'
840
- // '@stylistic/jsx-tag-spacing'
841
- // '@stylistic/jsx-wrap-multilines'
842
774
  return [
843
775
  {
844
776
  files: ruleFiles,
@@ -851,7 +783,227 @@ async function stylisticConfig(options = {}, scriptScope) {
851
783
  files: ruleFiles,
852
784
  name: 'waltz/stylistic/rules',
853
785
  rules: {
854
- ...configs.rules,
786
+ '@stylistic/array-bracket-spacing': ['error', 'never'],
787
+ '@stylistic/arrow-parens': [
788
+ 'error',
789
+ 'as-needed',
790
+ { requireForBlockBody: true },
791
+ ],
792
+ '@stylistic/arrow-spacing': [
793
+ 'error',
794
+ { after: true, before: true },
795
+ ],
796
+ '@stylistic/block-spacing': ['error', 'always'],
797
+ '@stylistic/brace-style': [
798
+ 'error',
799
+ 'stroustrup',
800
+ { allowSingleLine: true },
801
+ ],
802
+ '@stylistic/comma-dangle': ['error', 'always-multiline'],
803
+ '@stylistic/comma-spacing': [
804
+ 'error',
805
+ { after: true, before: false },
806
+ ],
807
+ '@stylistic/comma-style': ['error', 'last'],
808
+ '@stylistic/computed-property-spacing': [
809
+ 'error',
810
+ 'never',
811
+ { enforceForClassMembers: true },
812
+ ],
813
+ '@stylistic/dot-location': ['error', 'property'],
814
+ '@stylistic/eol-last': 'error',
815
+ '@stylistic/generator-star-spacing': [
816
+ 'error',
817
+ { after: true, before: false },
818
+ ],
819
+ '@stylistic/indent': [
820
+ 'error',
821
+ 2,
822
+ {
823
+ ArrayExpression: 1,
824
+ CallExpression: { arguments: 1 },
825
+ flatTernaryExpressions: false,
826
+ FunctionDeclaration: {
827
+ body: 1,
828
+ parameters: 1,
829
+ returnType: 1,
830
+ },
831
+ FunctionExpression: {
832
+ body: 1,
833
+ parameters: 1,
834
+ returnType: 1,
835
+ },
836
+ ignoreComments: false,
837
+ ignoredNodes: ['TSUnionType', 'TSIntersectionType'],
838
+ ImportDeclaration: 1,
839
+ MemberExpression: 1,
840
+ ObjectExpression: 1,
841
+ offsetTernaryExpressions: true,
842
+ outerIIFEBody: 1,
843
+ SwitchCase: 1,
844
+ tabLength: 2,
845
+ VariableDeclarator: 1,
846
+ },
847
+ ],
848
+ '@stylistic/indent-binary-ops': ['error', 2],
849
+ '@stylistic/jsx-closing-bracket-location': 'error',
850
+ '@stylistic/jsx-closing-tag-location': 'error',
851
+ '@stylistic/jsx-curly-brace-presence': [
852
+ 'error',
853
+ { propElementValues: 'always' },
854
+ ],
855
+ '@stylistic/jsx-curly-newline': 'error',
856
+ '@stylistic/jsx-curly-spacing': ['error', 'never'],
857
+ '@stylistic/jsx-equals-spacing': 'error',
858
+ '@stylistic/jsx-first-prop-new-line': 'error',
859
+ '@stylistic/jsx-function-call-newline': ['error', 'multiline'],
860
+ '@stylistic/jsx-indent-props': ['error', 2],
861
+ '@stylistic/jsx-max-props-per-line': [
862
+ 'error',
863
+ { maximum: 1, when: 'multiline' },
864
+ ],
865
+ '@stylistic/jsx-one-expression-per-line': [
866
+ 'error',
867
+ { allow: 'single-child' },
868
+ ],
869
+ '@stylistic/jsx-quotes': 'error',
870
+ '@stylistic/jsx-tag-spacing': [
871
+ 'error',
872
+ {
873
+ afterOpening: 'never',
874
+ beforeClosing: 'never',
875
+ beforeSelfClosing: 'always',
876
+ closingSlash: 'never',
877
+ },
878
+ ],
879
+ '@stylistic/jsx-wrap-multilines': [
880
+ 'error',
881
+ {
882
+ arrow: 'parens-new-line',
883
+ assignment: 'parens-new-line',
884
+ condition: 'parens-new-line',
885
+ declaration: 'parens-new-line',
886
+ logical: 'parens-new-line',
887
+ prop: 'parens-new-line',
888
+ propertyValue: 'parens-new-line',
889
+ return: 'parens-new-line',
890
+ },
891
+ ],
892
+ '@stylistic/key-spacing': [
893
+ 'error',
894
+ { afterColon: true, beforeColon: false },
895
+ ],
896
+ '@stylistic/keyword-spacing': [
897
+ 'error',
898
+ { after: true, before: true },
899
+ ],
900
+ '@stylistic/lines-between-class-members': [
901
+ 'error',
902
+ 'always',
903
+ { exceptAfterSingleLine: true },
904
+ ],
905
+ '@stylistic/max-statements-per-line': ['error', { max: 1 }],
906
+ '@stylistic/member-delimiter-style': [
907
+ 'error',
908
+ {
909
+ multiline: {
910
+ delimiter: 'none',
911
+ requireLast: false,
912
+ },
913
+ multilineDetection: 'brackets',
914
+ overrides: {
915
+ interface: {
916
+ multiline: {
917
+ delimiter: 'none',
918
+ requireLast: false,
919
+ },
920
+ },
921
+ },
922
+ singleline: { delimiter: 'comma' },
923
+ },
924
+ ],
925
+ '@stylistic/multiline-ternary': ['error', 'always-multiline'],
926
+ '@stylistic/new-parens': 'error',
927
+ '@stylistic/no-extra-parens': ['error', 'functions'],
928
+ '@stylistic/no-floating-decimal': 'error',
929
+ '@stylistic/no-mixed-operators': [
930
+ 'error',
931
+ {
932
+ allowSamePrecedence: true,
933
+ groups: [
934
+ ['==', '!=', '===', '!==', '>', '>=', '<', '<='],
935
+ ['&&', '||'],
936
+ ['in', 'instanceof'],
937
+ ],
938
+ },
939
+ ],
940
+ '@stylistic/no-mixed-spaces-and-tabs': 'error',
941
+ '@stylistic/no-multi-spaces': 'error',
942
+ '@stylistic/no-multiple-empty-lines': [
943
+ 'error',
944
+ { max: 1, maxBOF: 0, maxEOF: 0 },
945
+ ],
946
+ '@stylistic/no-tabs': 'error',
947
+ '@stylistic/no-trailing-spaces': 'error',
948
+ '@stylistic/no-whitespace-before-property': 'error',
949
+ '@stylistic/object-curly-spacing': ['error', 'always'],
950
+ '@stylistic/operator-linebreak': ['error', 'before'],
951
+ '@stylistic/padded-blocks': [
952
+ 'error',
953
+ { blocks: 'never', classes: 'never', switches: 'never' },
954
+ ],
955
+ '@stylistic/quote-props': ['error', 'consistent-as-needed'],
956
+ '@stylistic/quotes': [
957
+ 'error',
958
+ 'single',
959
+ { allowTemplateLiterals: 'always', avoidEscape: false },
960
+ ],
961
+ '@stylistic/rest-spread-spacing': ['error', 'never'],
962
+ '@stylistic/semi': ['error', 'never'],
963
+ '@stylistic/semi-spacing': [
964
+ 'error',
965
+ { after: true, before: false },
966
+ ],
967
+ '@stylistic/space-before-blocks': ['error', 'always'],
968
+ '@stylistic/space-before-function-paren': [
969
+ 'error',
970
+ { anonymous: 'always', asyncArrow: 'always', named: 'never' },
971
+ ],
972
+ '@stylistic/space-in-parens': ['error', 'never'],
973
+ '@stylistic/space-infix-ops': 'error',
974
+ '@stylistic/space-unary-ops': [
975
+ 'error',
976
+ { nonwords: false, words: true },
977
+ ],
978
+ '@stylistic/spaced-comment': [
979
+ 'error',
980
+ 'always',
981
+ {
982
+ block: {
983
+ balanced: true,
984
+ exceptions: ['*'],
985
+ markers: ['!'],
986
+ },
987
+ line: {
988
+ exceptions: ['/', '#'],
989
+ markers: ['/'],
990
+ },
991
+ },
992
+ ],
993
+ '@stylistic/template-curly-spacing': 'error',
994
+ '@stylistic/template-tag-spacing': ['error', 'never'],
995
+ '@stylistic/type-annotation-spacing': ['error', {}],
996
+ '@stylistic/type-generic-spacing': 'error',
997
+ '@stylistic/type-named-tuple-spacing': 'error',
998
+ '@stylistic/wrap-iife': [
999
+ 'error',
1000
+ 'any',
1001
+ { functionPrototypeMethods: true },
1002
+ ],
1003
+ '@stylistic/yield-star-spacing': [
1004
+ 'error',
1005
+ { after: true, before: false },
1006
+ ],
855
1007
  ...options.overrides,
856
1008
  },
857
1009
  },
@@ -860,12 +1012,17 @@ async function stylisticConfig(options = {}, scriptScope) {
860
1012
 
861
1013
  async function tailwindcssConfig(options = {}, scriptScope) {
862
1014
  const tailwindcss = await importTailwindcssPlugin();
863
- const recommended = tailwindcss.configs.recommended;
864
1015
  const files = resolveFiles(options.files, getScriptFiles(scriptScope));
865
1016
  return [
866
1017
  {
867
1018
  files,
868
- languageOptions: recommended.languageOptions,
1019
+ languageOptions: {
1020
+ parserOptions: {
1021
+ // Since Tailwind can be enabled independently—even without enabling
1022
+ // React—it ensures that JSX files are parsed correctly.
1023
+ ecmaFeatures: { jsx: true },
1024
+ },
1025
+ },
869
1026
  name: 'waltz/tailwindcss/setup',
870
1027
  plugins: {
871
1028
  tailwindcss,
@@ -875,11 +1032,21 @@ async function tailwindcssConfig(options = {}, scriptScope) {
875
1032
  files,
876
1033
  name: 'waltz/tailwindcss/rules',
877
1034
  rules: {
878
- ...recommended.rules,
1035
+ 'tailwindcss/classnames-order': 'warn',
1036
+ 'tailwindcss/enforces-canonical-classname': 'warn',
1037
+ 'tailwindcss/enforces-negative-arbitrary-values': 'warn',
1038
+ 'tailwindcss/enforces-shorthand': 'warn',
1039
+ 'tailwindcss/important-modifier-suffix': 'warn',
1040
+ 'tailwindcss/no-arbitrary-value': 'off',
1041
+ 'tailwindcss/no-contradicting-classname': 'error',
1042
+ // Generally, custom class names are supported, so the recommended practice
1043
+ // is not followed here.
1044
+ 'tailwindcss/no-custom-classname': 'off',
1045
+ 'tailwindcss/no-unnecessary-arbitrary-value': 'warn',
879
1046
  ...options.overrides,
880
1047
  },
881
1048
  settings: {
882
- ...recommended.settings,
1049
+ tailwindcss: {},
883
1050
  ...options.settings,
884
1051
  },
885
1052
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chanyuxi/eslint-waltz",
3
3
  "type": "module",
4
- "version": "1.3.1",
4
+ "version": "1.3.2",
5
5
  "packageManager": "pnpm@10.4.1",
6
6
  "description": "A composable ESLint flat config for JavaScript, TypeScript, JSONC, imports, React, Tailwind CSS, Perfectionist, and Vitest.",
7
7
  "author": "chanyuxi <2438149743@qq.com> (https://github.com/chanyuxi)",
@@ -9,7 +9,7 @@
9
9
  "homepage": "https://github.com/chanyuxi/eslint-waltz",
10
10
  "repository": {
11
11
  "type": "git",
12
- "url": "https://github.com/chanyuxi/eslint-waltz.git"
12
+ "url": "git+https://github.com/chanyuxi/eslint-waltz.git"
13
13
  },
14
14
  "bugs": {
15
15
  "url": "https://github.com/chanyuxi/eslint-waltz/issues"
@@ -31,7 +31,7 @@
31
31
  }
32
32
  },
33
33
  "bin": {
34
- "eslint-waltz": "./dist/cli.js"
34
+ "eslint-waltz": "dist/cli.js"
35
35
  },
36
36
  "files": [
37
37
  "dist"
@@ -49,7 +49,7 @@
49
49
  "check": "pnpm run typeCheck && pnpm run lint && pnpm run test",
50
50
  "changeset": "changeset",
51
51
  "version": "changeset version && pnpm install --lockfile-only",
52
- "release": "changeset publish",
52
+ "release": "changeset publish",
53
53
  "prepack": "pnpm build",
54
54
  "prepare": "husky"
55
55
  },