@atlaskit/eslint-plugin-platform 0.6.2 → 0.7.1

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 (126) hide show
  1. package/CHANGELOG.md +106 -90
  2. package/afm-jira/tsconfig.json +20 -0
  3. package/dist/cjs/index.js +24 -2
  4. package/dist/cjs/rules/constants.js +11 -0
  5. package/dist/cjs/rules/ensure-critical-dependency-resolutions/index.js +54 -6
  6. package/dist/cjs/rules/ensure-native-and-af-exports-synced/index.js +16 -7
  7. package/dist/cjs/rules/ensure-valid-emotion-css-prop/index.js +91 -0
  8. package/dist/cjs/rules/inline-usage/index.js +94 -0
  9. package/dist/cjs/rules/no-alias/index.js +64 -0
  10. package/dist/cjs/rules/no-module-level-eval/index.js +45 -0
  11. package/dist/cjs/rules/no-preconditioning/index.js +108 -0
  12. package/dist/cjs/rules/prefer-fg/index.js +106 -0
  13. package/dist/cjs/rules/static-feature-flags/index.js +63 -0
  14. package/dist/cjs/rules/use-recommended-utils/index.js +47 -0
  15. package/dist/cjs/rules/util/registration-utils.js +2 -1
  16. package/dist/cjs/rules/utils.js +53 -0
  17. package/dist/es2019/index.js +24 -2
  18. package/dist/es2019/rules/constants.js +5 -0
  19. package/dist/es2019/rules/ensure-critical-dependency-resolutions/index.js +52 -6
  20. package/dist/es2019/rules/ensure-native-and-af-exports-synced/index.js +15 -7
  21. package/dist/es2019/rules/ensure-valid-emotion-css-prop/index.js +87 -0
  22. package/dist/es2019/rules/inline-usage/index.js +90 -0
  23. package/dist/es2019/rules/no-alias/index.js +58 -0
  24. package/dist/es2019/rules/no-module-level-eval/index.js +39 -0
  25. package/dist/es2019/rules/no-preconditioning/index.js +105 -0
  26. package/dist/es2019/rules/prefer-fg/index.js +81 -0
  27. package/dist/es2019/rules/static-feature-flags/index.js +54 -0
  28. package/dist/es2019/rules/use-recommended-utils/index.js +41 -0
  29. package/dist/es2019/rules/util/registration-utils.js +2 -1
  30. package/dist/es2019/rules/utils.js +29 -0
  31. package/dist/esm/index.js +24 -2
  32. package/dist/esm/rules/constants.js +5 -0
  33. package/dist/esm/rules/ensure-critical-dependency-resolutions/index.js +54 -6
  34. package/dist/esm/rules/ensure-native-and-af-exports-synced/index.js +16 -7
  35. package/dist/esm/rules/ensure-valid-emotion-css-prop/index.js +85 -0
  36. package/dist/esm/rules/inline-usage/index.js +87 -0
  37. package/dist/esm/rules/no-alias/index.js +57 -0
  38. package/dist/esm/rules/no-module-level-eval/index.js +39 -0
  39. package/dist/esm/rules/no-preconditioning/index.js +102 -0
  40. package/dist/esm/rules/prefer-fg/index.js +99 -0
  41. package/dist/esm/rules/static-feature-flags/index.js +56 -0
  42. package/dist/esm/rules/use-recommended-utils/index.js +41 -0
  43. package/dist/esm/rules/util/registration-utils.js +2 -1
  44. package/dist/esm/rules/utils.js +45 -0
  45. package/dist/types/index.d.ts +14 -0
  46. package/dist/types/rules/constants.d.ts +3 -0
  47. package/dist/types/rules/ensure-valid-emotion-css-prop/index.d.ts +3 -0
  48. package/dist/types/rules/inline-usage/index.d.ts +3 -0
  49. package/dist/types/rules/no-alias/index.d.ts +3 -0
  50. package/dist/types/rules/no-module-level-eval/index.d.ts +3 -0
  51. package/dist/types/rules/no-preconditioning/index.d.ts +3 -0
  52. package/dist/types/rules/prefer-fg/index.d.ts +3 -0
  53. package/dist/types/rules/static-feature-flags/index.d.ts +3 -0
  54. package/dist/types/rules/use-recommended-utils/index.d.ts +3 -0
  55. package/dist/types/rules/util/registration-utils.d.ts +1 -0
  56. package/dist/types/rules/utils.d.ts +7 -0
  57. package/dist/types-ts4.5/index.d.ts +14 -0
  58. package/dist/types-ts4.5/rules/constants.d.ts +3 -0
  59. package/dist/types-ts4.5/rules/ensure-valid-emotion-css-prop/index.d.ts +3 -0
  60. package/dist/types-ts4.5/rules/inline-usage/index.d.ts +3 -0
  61. package/dist/types-ts4.5/rules/no-alias/index.d.ts +3 -0
  62. package/dist/types-ts4.5/rules/no-module-level-eval/index.d.ts +3 -0
  63. package/dist/types-ts4.5/rules/no-preconditioning/index.d.ts +3 -0
  64. package/dist/types-ts4.5/rules/prefer-fg/index.d.ts +3 -0
  65. package/dist/types-ts4.5/rules/static-feature-flags/index.d.ts +3 -0
  66. package/dist/types-ts4.5/rules/use-recommended-utils/index.d.ts +3 -0
  67. package/dist/types-ts4.5/rules/util/registration-utils.d.ts +1 -0
  68. package/dist/types-ts4.5/rules/utils.d.ts +7 -0
  69. package/index.js +9 -9
  70. package/package.json +43 -44
  71. package/report.api.md +31 -30
  72. package/src/__tests__/utils/_tester.tsx +16 -16
  73. package/src/index.tsx +99 -77
  74. package/src/rules/constants.tsx +20 -0
  75. package/src/rules/ensure-atlassian-team/__tests__/unit/rule.test.ts +19 -19
  76. package/src/rules/ensure-atlassian-team/index.ts +39 -52
  77. package/src/rules/ensure-critical-dependency-resolutions/__test__/unit/rule.test.tsx +146 -81
  78. package/src/rules/ensure-critical-dependency-resolutions/index.tsx +152 -97
  79. package/src/rules/ensure-feature-flag-prefix/__tests__/unit/rule.test.tsx +50 -50
  80. package/src/rules/ensure-feature-flag-prefix/index.tsx +65 -80
  81. package/src/rules/ensure-feature-flag-registration/__tests__/unit/rule.test.tsx +96 -96
  82. package/src/rules/ensure-feature-flag-registration/index.tsx +88 -105
  83. package/src/rules/ensure-native-and-af-exports-synced/__tests__/unit/rule.test.tsx +179 -179
  84. package/src/rules/ensure-native-and-af-exports-synced/index.tsx +162 -168
  85. package/src/rules/ensure-publish-valid/__tests__/unit/rule.test.ts +34 -36
  86. package/src/rules/ensure-publish-valid/index.ts +66 -81
  87. package/src/rules/ensure-test-runner-arguments/__tests__/unit/rule.test.tsx +93 -93
  88. package/src/rules/ensure-test-runner-arguments/index.tsx +107 -121
  89. package/src/rules/ensure-test-runner-nested-count/__tests__/unit/rule.test.tsx +43 -43
  90. package/src/rules/ensure-test-runner-nested-count/index.tsx +68 -70
  91. package/src/rules/ensure-valid-emotion-css-prop/__tests__/unit/rule.test.ts +142 -0
  92. package/src/rules/ensure-valid-emotion-css-prop/index.ts +96 -0
  93. package/src/rules/inline-usage/README.md +53 -0
  94. package/src/rules/inline-usage/__tests__/rule.test.tsx +106 -0
  95. package/src/rules/inline-usage/index.tsx +130 -0
  96. package/src/rules/no-alias/README.md +29 -0
  97. package/src/rules/no-alias/__tests__/rule.test.tsx +76 -0
  98. package/src/rules/no-alias/index.tsx +75 -0
  99. package/src/rules/no-duplicate-dependencies/__tests__/unit/rule.test.ts +44 -44
  100. package/src/rules/no-duplicate-dependencies/index.ts +68 -73
  101. package/src/rules/no-invalid-feature-flag-usage/__tests__/unit/rule.test.tsx +64 -64
  102. package/src/rules/no-invalid-feature-flag-usage/index.tsx +105 -112
  103. package/src/rules/no-invalid-storybook-decorator-usage/__tests__/unit/rule.test.tsx +13 -13
  104. package/src/rules/no-invalid-storybook-decorator-usage/index.tsx +28 -30
  105. package/src/rules/no-module-level-eval/README.md +53 -0
  106. package/src/rules/no-module-level-eval/__tests__/test.tsx +133 -0
  107. package/src/rules/no-module-level-eval/index.tsx +52 -0
  108. package/src/rules/no-pre-post-installs/__tests__/unit/rule.test.ts +36 -36
  109. package/src/rules/no-pre-post-installs/index.ts +27 -27
  110. package/src/rules/no-preconditioning/README.md +69 -0
  111. package/src/rules/no-preconditioning/__tests__/rule.test.tsx +164 -0
  112. package/src/rules/no-preconditioning/index.tsx +138 -0
  113. package/src/rules/prefer-fg/README.md +3 -0
  114. package/src/rules/prefer-fg/__tests__/rule.test.tsx +83 -0
  115. package/src/rules/prefer-fg/index.tsx +108 -0
  116. package/src/rules/static-feature-flags/README.md +3 -0
  117. package/src/rules/static-feature-flags/__tests__/test.tsx +135 -0
  118. package/src/rules/static-feature-flags/index.tsx +103 -0
  119. package/src/rules/use-recommended-utils/README.md +67 -0
  120. package/src/rules/use-recommended-utils/__tests__/rule.test.tsx +78 -0
  121. package/src/rules/use-recommended-utils/index.tsx +57 -0
  122. package/src/rules/util/handle-ast-object.ts +21 -32
  123. package/src/rules/util/registration-utils.ts +31 -30
  124. package/src/rules/utils.tsx +46 -0
  125. package/tsconfig.app.json +35 -35
  126. package/tsconfig.dev.json +39 -39
package/CHANGELOG.md CHANGED
@@ -1,236 +1,252 @@
1
1
  # @atlaskit/eslint-plugin-platform
2
2
 
3
+ ## 0.7.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#116062](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/116062)
8
+ [`c965047f03c61`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c965047f03c61) -
9
+ Update rule docs link.
10
+
11
+ ## 0.7.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [#115707](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/115707)
16
+ [`a5cce078e311b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a5cce078e311b) -
17
+ Add new feature flag rules and add them to the recommended preset as error violations.
18
+
3
19
  ## 0.6.2
4
20
 
5
21
  ### Patch Changes
6
22
 
7
- - [#104090](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/104090)
8
- [`3f7cadbe8c81`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3f7cadbe8c81) -
9
- Fixed an issue with the package.json processor in FlatConfig
23
+ - [#104090](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/104090)
24
+ [`3f7cadbe8c81`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3f7cadbe8c81) -
25
+ Fixed an issue with the package.json processor in FlatConfig
10
26
 
11
27
  ## 0.6.1
12
28
 
13
29
  ### Patch Changes
14
30
 
15
- - [#83116](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/83116)
16
- [`8d4e99057fe0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8d4e99057fe0) -
17
- Upgrade Typescript from `4.9.5` to `5.4.2`
31
+ - [#83116](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/83116)
32
+ [`8d4e99057fe0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8d4e99057fe0) -
33
+ Upgrade Typescript from `4.9.5` to `5.4.2`
18
34
 
19
35
  ## 0.6.0
20
36
 
21
37
  ### Minor Changes
22
38
 
23
- - [#82550](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/82550)
24
- [`f0948af9e586`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f0948af9e586) -
25
- Allow typescript upgrade to 5.x
39
+ - [#82550](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/82550)
40
+ [`f0948af9e586`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f0948af9e586) -
41
+ Allow typescript upgrade to 5.x
26
42
 
27
43
  ## 0.5.0
28
44
 
29
45
  ### Minor Changes
30
46
 
31
- - [#81166](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/81166)
32
- [`a249a1bd29a6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a249a1bd29a6) -
33
- Upgrade ESLint to version 8
47
+ - [#81166](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/81166)
48
+ [`a249a1bd29a6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a249a1bd29a6) -
49
+ Upgrade ESLint to version 8
34
50
 
35
51
  ## 0.4.1
36
52
 
37
53
  ### Patch Changes
38
54
 
39
- - [#78702](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/78702)
40
- [`6b76dabb8255`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6b76dabb8255) -
41
- Add rule to check for invalid flag usages in exports
55
+ - [#78702](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/78702)
56
+ [`6b76dabb8255`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6b76dabb8255) -
57
+ Add rule to check for invalid flag usages in exports
42
58
 
43
59
  ## 0.4.0
44
60
 
45
61
  ### Minor Changes
46
62
 
47
- - [#43563](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/43563)
48
- [`51f9f6e2f10`](https://bitbucket.org/atlassian/atlassian-frontend/commits/51f9f6e2f10) - Add
49
- @types/react v18.2 to critical deps whitelist
63
+ - [#43563](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/43563)
64
+ [`51f9f6e2f10`](https://bitbucket.org/atlassian/atlassian-frontend/commits/51f9f6e2f10) - Add
65
+ @types/react v18.2 to critical deps whitelist
50
66
 
51
67
  ## 0.3.0
52
68
 
53
69
  ### Minor Changes
54
70
 
55
- - [#41190](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41190)
56
- [`a5047d254d4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a5047d254d4) - Add
57
- no-duplicate-dependencies rule and enable package-json-processor autofix
71
+ - [#41190](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41190)
72
+ [`a5047d254d4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a5047d254d4) - Add
73
+ no-duplicate-dependencies rule and enable package-json-processor autofix
58
74
 
59
75
  ## 0.2.6
60
76
 
61
77
  ### Patch Changes
62
78
 
63
- - [#39249](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/39249)
64
- [`7efeb93141c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7efeb93141c) - Add a
65
- rule to ensure critical packages are resolved to the correct versions
79
+ - [#39249](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/39249)
80
+ [`7efeb93141c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7efeb93141c) - Add a
81
+ rule to ensure critical packages are resolved to the correct versions
66
82
 
67
83
  ## 0.2.5
68
84
 
69
85
  ### Patch Changes
70
86
 
71
- - [#39049](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/39049)
72
- [`e5f52093b2a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e5f52093b2a) - Add a
73
- rule to ensure that publish config is correct for packages
87
+ - [#39049](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/39049)
88
+ [`e5f52093b2a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e5f52093b2a) - Add a
89
+ rule to ensure that publish config is correct for packages
74
90
 
75
91
  ## 0.2.4
76
92
 
77
93
  ### Patch Changes
78
94
 
79
- - [#38261](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/38261)
80
- [`eb64cbdd681`](https://bitbucket.org/atlassian/atlassian-frontend/commits/eb64cbdd681) - Add a
81
- new rule to verify that the atlassian team is defined if the relevant section exists in the
82
- package.json
95
+ - [#38261](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/38261)
96
+ [`eb64cbdd681`](https://bitbucket.org/atlassian/atlassian-frontend/commits/eb64cbdd681) - Add a
97
+ new rule to verify that the atlassian team is defined if the relevant section exists in the
98
+ package.json
83
99
 
84
100
  ## 0.2.3
85
101
 
86
102
  ### Patch Changes
87
103
 
88
- - [#33879](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33879)
89
- [`0bf64fb3dd0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0bf64fb3dd0) - Update
90
- to support unary expressions like negation
104
+ - [#33879](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33879)
105
+ [`0bf64fb3dd0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0bf64fb3dd0) - Update
106
+ to support unary expressions like negation
91
107
 
92
108
  ## 0.2.2
93
109
 
94
110
  ### Patch Changes
95
111
 
96
- - [#33793](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33793)
97
- [`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure
98
- legacy types are published for TS 4.5-4.8
112
+ - [#33793](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33793)
113
+ [`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure
114
+ legacy types are published for TS 4.5-4.8
99
115
 
100
116
  ## 0.2.1
101
117
 
102
118
  ### Patch Changes
103
119
 
104
- - [#33649](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33649)
105
- [`41fae2c6f68`](https://bitbucket.org/atlassian/atlassian-frontend/commits/41fae2c6f68) -
106
- Upgrade Typescript from `4.5.5` to `4.9.5`
120
+ - [#33649](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33649)
121
+ [`41fae2c6f68`](https://bitbucket.org/atlassian/atlassian-frontend/commits/41fae2c6f68) - Upgrade
122
+ Typescript from `4.5.5` to `4.9.5`
107
123
 
108
124
  ## 0.2.0
109
125
 
110
126
  ### Minor Changes
111
127
 
112
- - [#33258](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33258)
113
- [`56507598609`](https://bitbucket.org/atlassian/atlassian-frontend/commits/56507598609) - Skip
114
- minor dependency bump
128
+ - [#33258](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33258)
129
+ [`56507598609`](https://bitbucket.org/atlassian/atlassian-frontend/commits/56507598609) - Skip
130
+ minor dependency bump
115
131
 
116
132
  ## 0.1.8
117
133
 
118
134
  ### Patch Changes
119
135
 
120
- - [#32441](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/32441)
121
- [`cb0e94d2ce4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cb0e94d2ce4) - Fix
122
- prefixes for all flags being checked at any callsite, only the current flag will be checked from
123
- now on
136
+ - [#32441](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/32441)
137
+ [`cb0e94d2ce4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cb0e94d2ce4) - Fix
138
+ prefixes for all flags being checked at any callsite, only the current flag will be checked from
139
+ now on
124
140
 
125
141
  ## 0.1.7
126
142
 
127
143
  ### Patch Changes
128
144
 
129
- - [#32424](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/32424)
130
- [`2e01c9c74b5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2e01c9c74b5) - DUMMY
131
- remove before merging to master; dupe adf-schema via adf-utils
145
+ - [#32424](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/32424)
146
+ [`2e01c9c74b5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2e01c9c74b5) - DUMMY
147
+ remove before merging to master; dupe adf-schema via adf-utils
132
148
 
133
149
  ## 0.1.6
134
150
 
135
151
  ### Patch Changes
136
152
 
137
- - [#31962](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/31962)
138
- [`e8a8808f299`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e8a8808f299) - Add a
139
- new eslint rule that enforces prefixes on platform feature flags. Ignore existing usages.
153
+ - [#31962](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/31962)
154
+ [`e8a8808f299`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e8a8808f299) - Add a
155
+ new eslint rule that enforces prefixes on platform feature flags. Ignore existing usages.
140
156
 
141
157
  ## 0.1.5
142
158
 
143
159
  ### Patch Changes
144
160
 
145
- - [#31956](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/31956)
146
- [`b47e48ad163`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b47e48ad163) - Adds
147
- an eslint rule to confirm that storybooks only get passed an object - to ensure that codemods
148
- work correctly.
161
+ - [#31956](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/31956)
162
+ [`b47e48ad163`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b47e48ad163) - Adds an
163
+ eslint rule to confirm that storybooks only get passed an object - to ensure that codemods work
164
+ correctly.
149
165
 
150
166
  ## 0.1.4
151
167
 
152
168
  ### Patch Changes
153
169
 
154
- - [#31631](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/31631)
155
- [`971489f4ff4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/971489f4ff4) - Add
156
- test runner to identified calls that require registration of platform feature flags
170
+ - [#31631](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/31631)
171
+ [`971489f4ff4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/971489f4ff4) - Add test
172
+ runner to identified calls that require registration of platform feature flags
157
173
 
158
174
  ## 0.1.3
159
175
 
160
176
  ### Patch Changes
161
177
 
162
- - [#31581](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/31581)
163
- [`7facf919a4e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7facf919a4e) - Remove
164
- product specific rules and make it so the recommended set is used everywhere instead
178
+ - [#31581](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/31581)
179
+ [`7facf919a4e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7facf919a4e) - Remove
180
+ product specific rules and make it so the recommended set is used everywhere instead
165
181
 
166
182
  ## 0.1.2
167
183
 
168
184
  ### Patch Changes
169
185
 
170
- - [#31440](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/31440)
171
- [`166815fbd8f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/166815fbd8f) - Add
172
- recommended set of flags for use in products
186
+ - [#31440](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/31440)
187
+ [`166815fbd8f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/166815fbd8f) - Add
188
+ recommended set of flags for use in products
173
189
 
174
190
  ## 0.1.1
175
191
 
176
192
  ### Patch Changes
177
193
 
178
- - [#30710](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/30710)
179
- [`7edd9e8b4b1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7edd9e8b4b1) - Add
180
- suggestion to change feature flag to the closest matching feature flag using fuzzy search
194
+ - [#30710](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/30710)
195
+ [`7edd9e8b4b1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7edd9e8b4b1) - Add
196
+ suggestion to change feature flag to the closest matching feature flag using fuzzy search
181
197
 
182
198
  ## 0.1.0
183
199
 
184
200
  ### Minor Changes
185
201
 
186
- - [#30401](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/30401)
187
- [`6339334e3ac`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6339334e3ac) - Adds
188
- new rule to disallow pre/post install scripts in package.json.
202
+ - [#30401](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/30401)
203
+ [`6339334e3ac`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6339334e3ac) - Adds new
204
+ rule to disallow pre/post install scripts in package.json.
189
205
 
190
206
  ## 0.0.7
191
207
 
192
208
  ### Patch Changes
193
209
 
194
- - [#30777](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/30777)
195
- [`0cab60b90c3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0cab60b90c3) - Add
196
- fix to eslint rule on the arguments of nested test runner
210
+ - [#30777](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/30777)
211
+ [`0cab60b90c3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0cab60b90c3) - Add fix
212
+ to eslint rule on the arguments of nested test runner
197
213
 
198
214
  ## 0.0.6
199
215
 
200
216
  ### Patch Changes
201
217
 
202
- - [#30491](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/30491)
203
- [`99449cce7f5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/99449cce7f5) - Eslint
204
- rules around test runner arguments and limit on nested test runners
218
+ - [#30491](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/30491)
219
+ [`99449cce7f5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/99449cce7f5) - Eslint
220
+ rules around test runner arguments and limit on nested test runners
205
221
 
206
222
  ## 0.0.5
207
223
 
208
224
  ### Patch Changes
209
225
 
210
- - [#30484](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/30484)
211
- [`aeb52cac34c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/aeb52cac34c) - Split
212
- feature flag registration rule into two to more easily use it in products
226
+ - [#30484](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/30484)
227
+ [`aeb52cac34c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/aeb52cac34c) - Split
228
+ feature flag registration rule into two to more easily use it in products
213
229
 
214
230
  ## 0.0.4
215
231
 
216
232
  ### Patch Changes
217
233
 
218
- - [#30432](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/30432)
219
- [`cd5b194f403`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cd5b194f403) - Add
220
- check to ensure that there is only one feature flag call per expression
234
+ - [#30432](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/30432)
235
+ [`cd5b194f403`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cd5b194f403) - Add
236
+ check to ensure that there is only one feature flag call per expression
221
237
 
222
238
  ## 0.0.3
223
239
 
224
240
  ### Patch Changes
225
241
 
226
- - [#30320](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/30320)
227
- [`11706c3e7c5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/11706c3e7c5) -
228
- Publish platform eslint rules to npm to be consumed in other products
242
+ - [#30320](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/30320)
243
+ [`11706c3e7c5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/11706c3e7c5) - Publish
244
+ platform eslint rules to npm to be consumed in other products
229
245
 
230
246
  ## 0.0.2
231
247
 
232
248
  ### Patch Changes
233
249
 
234
- - [#28303](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/28303)
235
- [`85dc0230439`](https://bitbucket.org/atlassian/atlassian-frontend/commits/85dc0230439) - Add
236
- eslint rule to allow for platform feature flag usage
250
+ - [#28303](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/28303)
251
+ [`85dc0230439`](https://bitbucket.org/atlassian/atlassian-frontend/commits/85dc0230439) - Add
252
+ eslint rule to allow for platform feature flag usage
@@ -0,0 +1,20 @@
1
+ {
2
+ "extends": "../../../../tsconfig.entry-points.jira.json",
3
+ "compilerOptions": {
4
+ "target": "es5",
5
+ "outDir": "../../../../../tsDist/@atlaskit__eslint-plugin-platform/app",
6
+ "composite": true,
7
+ "rootDir": "../"
8
+ },
9
+ "include": [
10
+ "../src/**/*.ts",
11
+ "../src/**/*.tsx"
12
+ ],
13
+ "exclude": [
14
+ "../src/**/__tests__/*",
15
+ "../__tests__/*",
16
+ "../src/**/*.test.*",
17
+ "../src/**/test.*"
18
+ ],
19
+ "references": []
20
+ }
package/dist/cjs/index.js CHANGED
@@ -15,9 +15,17 @@ var _noDuplicateDependencies = _interopRequireDefault(require("./rules/no-duplic
15
15
  var _noInvalidFeatureFlagUsage = _interopRequireDefault(require("./rules/no-invalid-feature-flag-usage"));
16
16
  var _ensureFeatureFlagPrefix = _interopRequireDefault(require("./rules/ensure-feature-flag-prefix"));
17
17
  var _ensureCriticalDependencyResolutions = _interopRequireDefault(require("./rules/ensure-critical-dependency-resolutions"));
18
+ var _ensureValidEmotionCssProp = _interopRequireDefault(require("./rules/ensure-valid-emotion-css-prop"));
18
19
  var _noInvalidStorybookDecoratorUsage = _interopRequireDefault(require("./rules/no-invalid-storybook-decorator-usage"));
19
20
  var _ensurePublishValid = _interopRequireDefault(require("./rules/ensure-publish-valid"));
20
21
  var _ensureNativeAndAfExportsSynced = _interopRequireDefault(require("./rules/ensure-native-and-af-exports-synced"));
22
+ var _noModuleLevelEval = _interopRequireDefault(require("./rules/no-module-level-eval"));
23
+ var _staticFeatureFlags = _interopRequireDefault(require("./rules/static-feature-flags"));
24
+ var _noPreconditioning = _interopRequireDefault(require("./rules/no-preconditioning"));
25
+ var _inlineUsage = _interopRequireDefault(require("./rules/inline-usage"));
26
+ var _preferFg = _interopRequireDefault(require("./rules/prefer-fg"));
27
+ var _noAlias = _interopRequireDefault(require("./rules/no-alias"));
28
+ var _useRecommendedUtils = _interopRequireDefault(require("./rules/use-recommended-utils"));
21
29
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
22
30
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // eslint-disable-next-line import/no-extraneous-dependencies
23
31
  var rules = exports.rules = {
@@ -27,12 +35,20 @@ var rules = exports.rules = {
27
35
  'ensure-test-runner-nested-count': _ensureTestRunnerNestedCount.default,
28
36
  'ensure-atlassian-team': _ensureAtlassianTeam.default,
29
37
  'ensure-critical-dependency-resolutions': _ensureCriticalDependencyResolutions.default,
38
+ 'ensure-valid-emotion-css-prop': _ensureValidEmotionCssProp.default,
30
39
  'no-duplicate-dependencies': _noDuplicateDependencies.default,
31
40
  'no-invalid-feature-flag-usage': _noInvalidFeatureFlagUsage.default,
32
41
  'no-pre-post-install-scripts': _noPrePostInstalls.default,
33
42
  'no-invalid-storybook-decorator-usage': _noInvalidStorybookDecoratorUsage.default,
34
43
  'ensure-publish-valid': _ensurePublishValid.default,
35
- 'ensure-native-and-af-exports-synced': _ensureNativeAndAfExportsSynced.default
44
+ 'ensure-native-and-af-exports-synced': _ensureNativeAndAfExportsSynced.default,
45
+ 'no-module-level-eval': _noModuleLevelEval.default,
46
+ 'static-feature-flags': _staticFeatureFlags.default,
47
+ 'no-preconditioning': _noPreconditioning.default,
48
+ 'inline-usage': _inlineUsage.default,
49
+ 'prefer-fg': _preferFg.default,
50
+ 'no-alias': _noAlias.default,
51
+ 'use-recommended-utils': _useRecommendedUtils.default
36
52
  };
37
53
  var configs = exports.configs = {
38
54
  recommended: {
@@ -46,7 +62,13 @@ var configs = exports.configs = {
46
62
  '@atlaskit/platform/ensure-test-runner-nested-count': 'warn',
47
63
  '@atlaskit/platform/no-invalid-feature-flag-usage': 'error',
48
64
  '@atlaskit/platform/no-invalid-storybook-decorator-usage': 'error',
49
- '@atlaskit/platform/ensure-atlassian-team': 'error'
65
+ '@atlaskit/platform/ensure-atlassian-team': 'error',
66
+ '@atlaskit/platform/no-module-level-eval': 'error',
67
+ '@atlaskit/platform/static-feature-flags': 'error',
68
+ '@atlaskit/platform/no-preconditioning': 'error',
69
+ '@atlaskit/platform/inline-usage': 'error',
70
+ '@atlaskit/platform/prefer-fg': 'error',
71
+ '@atlaskit/platform/no-alias': 'error'
50
72
  }
51
73
  }
52
74
  };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.FEATURE_UTILS_IMPORT_SOURCES = exports.FEATURE_MOCKS_IMPORT_SOURCES = exports.FEATURE_API_IMPORT_SOURCES = void 0;
7
+ // List of libraries that we maintain or have worked on
8
+ // - eg `@atlaskit/feature-gate-js-client` shouldn't be included in here
9
+ var FEATURE_API_IMPORT_SOURCES = exports.FEATURE_API_IMPORT_SOURCES = new Set(['@atlassian/jira-feature-flagging', '@atlassian/jira-feature-flagging-using-meta', '@atlassian/jira-feature-gating', '@atlassian/jira-feature-experiments', '@atlaskit/platform-feature-flags']);
10
+ var FEATURE_MOCKS_IMPORT_SOURCES = exports.FEATURE_MOCKS_IMPORT_SOURCES = new Set(['@atlassian/jira-feature-flagging-mocks', '@atlassian/jira-feature-gates-test-mocks', '@atlassian/jira-feature-gates-storybook-mocks']);
11
+ var FEATURE_UTILS_IMPORT_SOURCES = exports.FEATURE_UTILS_IMPORT_SOURCES = new Set(['@atlassian/jira-feature-flagging-utils', '@atlassian/jira-feature-gate-component']);
@@ -15,30 +15,69 @@ var _handleAstObject = require("../util/handle-ast-object");
15
15
  //
16
16
  var DESIRED_PKG_VERSIONS = {
17
17
  typescript: ['5.4'],
18
- '@types/react': ['16.14', '18.2']
18
+ tslib: ['2.6'],
19
+ '@types/react': ['16.14', '18.2'],
20
+ 'react-relay': ['npm:atl-react-relay@0.0.0-main-2ccd6998'],
21
+ 'relay-compiler': ['npm:atl-relay-compiler@0.0.0-main-2ccd6998'],
22
+ 'relay-runtime': ['npm:atl-relay-runtime@0.0.0-main-2ccd6998'],
23
+ 'relay-test-utils': ['npm:atl-relay-test-utils@0.0.0-main-2ccd6998']
19
24
  };
20
25
  var matchMinorVersion = function matchMinorVersion(desiredVersion, versionInResolutions) {
21
26
  var firstChar = versionInResolutions[0];
22
27
  // The version is invalid if it doesn't start with a number or ~
23
- if (!/^\d$/.test(firstChar) && firstChar !== '~') {
28
+ if (!/^\d$/.test(firstChar) && firstChar !== '~' && !versionInResolutions.startsWith('npm:')) {
24
29
  return false;
25
30
  }
26
31
  return versionInResolutions.startsWith(desiredVersion) || versionInResolutions.startsWith('~' + desiredVersion);
27
32
  };
28
- var verifyResolutionFromObject = function verifyResolutionFromObject(node, pkg, version, optional) {
33
+ var verifyResolutionFromObject = function verifyResolutionFromObject(_ref) {
34
+ var resolutions = _ref.resolutions,
35
+ dependencies = _ref.dependencies,
36
+ devDependencies = _ref.devDependencies,
37
+ pkg = _ref.pkg,
38
+ version = _ref.version,
39
+ optional = _ref.optional;
29
40
  // For root package.json, we require the critical packages' resolutions exist and with matching version
30
41
  // For individual package's package.json, it's ok if resolutions don't exist. But if they do, the version should match
31
- var resolutionExist = node.properties.some(function (p) {
42
+ var resolutionExist = resolutions.properties.some(function (p) {
32
43
  return p.type === 'Property' && p.key.type === 'Literal' && p.key.value === pkg;
33
44
  });
45
+ isDependencyPresent({
46
+ resolutions: resolutions,
47
+ dependencies: dependencies,
48
+ devDependencies: devDependencies,
49
+ pkg: pkg
50
+ });
34
51
  if (!resolutionExist) {
52
+ // when package is not a part of dependencies/devDependencies
53
+ if (optional === false && !isDependencyPresent({
54
+ resolutions: resolutions,
55
+ dependencies: dependencies,
56
+ devDependencies: devDependencies,
57
+ pkg: pkg
58
+ })) {
59
+ return true;
60
+ }
35
61
  return optional;
36
62
  }
37
- var resolutionExistAndMatch = node.properties.some(function (p) {
63
+ var resolutionExistAndMatch = resolutions.properties.some(function (p) {
38
64
  return p.type === 'Property' && p.key.type === 'Literal' && p.key.value === pkg && p.value.type === 'Literal' && matchMinorVersion(version, p.value.value);
39
65
  });
40
66
  return resolutionExistAndMatch;
41
67
  };
68
+ var isDependencyPresent = function isDependencyPresent(_ref2) {
69
+ var resolutions = _ref2.resolutions,
70
+ dependencies = _ref2.dependencies,
71
+ devDependencies = _ref2.devDependencies,
72
+ pkg = _ref2.pkg;
73
+ var dependencyExist = dependencies !== null && dependencies.properties.some(function (p) {
74
+ return p.type === 'Property' && p.key.type === 'Literal' && p.key.value === pkg;
75
+ });
76
+ var devDependencyExist = devDependencies !== null && devDependencies.properties.some(function (p) {
77
+ return p.type === 'Property' && p.key.type === 'Literal' && p.key.value === pkg;
78
+ });
79
+ return dependencyExist || devDependencyExist;
80
+ };
42
81
  var rule = {
43
82
  meta: {
44
83
  type: 'problem',
@@ -67,6 +106,8 @@ var rule = {
67
106
  return;
68
107
  }
69
108
  var packageResolutions = (0, _handleAstObject.getObjectPropertyAsObject)(node, 'resolutions');
109
+ var packageDependencies = (0, _handleAstObject.getObjectPropertyAsObject)(node, 'dependencies');
110
+ var packageDevDependencies = (0, _handleAstObject.getObjectPropertyAsObject)(node, 'devDependencies');
70
111
  var rootDir = (0, _findRoot.findRootSync)(process.cwd());
71
112
  var isRootPackageJson = fileName.endsWith("".concat(rootDir, "/package.json"));
72
113
  if (packageResolutions !== null) {
@@ -75,7 +116,14 @@ var rule = {
75
116
  key = _Object$entries$_i[0],
76
117
  values = _Object$entries$_i[1];
77
118
  if (!values.some(function (value) {
78
- return verifyResolutionFromObject(packageResolutions, key, value, !isRootPackageJson);
119
+ return verifyResolutionFromObject({
120
+ resolutions: packageResolutions,
121
+ dependencies: packageDependencies,
122
+ devDependencies: packageDevDependencies,
123
+ pkg: key,
124
+ version: value,
125
+ optional: !isRootPackageJson
126
+ });
79
127
  })) {
80
128
  return {
81
129
  v: context.report({
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
8
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
11
  var _path = _interopRequireDefault(require("path"));
@@ -77,7 +78,7 @@ var rule = {
77
78
  });
78
79
  continue;
79
80
  }
80
- var exportValueViolations = getExportValueViolation(pkgName, afExportsKey, afExportsValue, nativeExports);
81
+ var exportValueViolations = getExportValueViolation(afExportsKey, afExportsValue, nativeExports);
81
82
  if (exportValueViolations) {
82
83
  context.report({
83
84
  data: _objectSpread(_objectSpread({}, exportValueViolations), {}, {
@@ -94,7 +95,7 @@ var rule = {
94
95
  }
95
96
  };
96
97
  function getExportKeyViolation(afExportsKey, afExportsValue, nativeExports) {
97
- var afExportsValueHasExtension = _path.default.extname(afExportsValue);
98
+ var afExportsValueHasExtension = _path.default.extname(afExportsValue) !== '';
98
99
  if (afExportsValueHasExtension && !nativeExports.hasOwnProperty(afExportsKey)) {
99
100
  return {
100
101
  messageId: 'missingExportsKey',
@@ -117,15 +118,23 @@ function getExportKeyViolation(afExportsKey, afExportsValue, nativeExports) {
117
118
  };
118
119
  }
119
120
  }
120
- function getExportValueViolation(pkgName, afExportsKey, afExportsValue, nativeExports) {
121
- var afExportsValueHasExtension = _path.default.extname(afExportsValue);
121
+ function getNativeExportsValue(afExportsKey, afExportsValueHasExtension, nativeExports) {
122
+ var nativeExportsKey = afExportsValueHasExtension ? afExportsKey : "".concat(afExportsKey, "/*");
123
+ if ((0, _typeof2.default)(nativeExports[nativeExportsKey]) === 'object') {
124
+ return nativeExports[nativeExportsKey].default;
125
+ }
126
+ return nativeExports[nativeExportsKey];
127
+ }
128
+ function getExportValueViolation(afExportsKey, afExportsValue, nativeExports) {
129
+ var afExportsValueHasExtension = _path.default.extname(afExportsValue) !== '';
130
+ var nativeExportsValue = getNativeExportsValue(afExportsKey, afExportsValueHasExtension, nativeExports);
122
131
 
123
132
  // Some entrypoints have been updated to an index.js file that registers ts-node
124
133
  // Use path.basename to get the file name to see if it is equal to 'index.js'
125
- if (afExportsValueHasExtension && _path.default.basename(nativeExports[afExportsKey]) === 'index.js') {
134
+ if (afExportsValueHasExtension && _path.default.basename(nativeExportsValue) === 'index.js') {
126
135
  return;
127
136
  }
128
- if (afExportsValueHasExtension && nativeExports[afExportsKey] !== afExportsValue) {
137
+ if (afExportsValueHasExtension && nativeExportsValue !== afExportsValue) {
129
138
  return {
130
139
  key: afExportsKey,
131
140
  expectedValue: afExportsValue
@@ -133,7 +142,7 @@ function getExportValueViolation(pkgName, afExportsKey, afExportsValue, nativeEx
133
142
  }
134
143
 
135
144
  // af:exports entrypoints without a file extension export the whole directory so check to ensure the exports value includes the wildcard
136
- if (!afExportsValueHasExtension && !nativeExports["".concat(afExportsKey, "/*")].startsWith("".concat(afExportsValue, "/*"))) {
145
+ if (!afExportsValueHasExtension && !nativeExportsValue.startsWith("".concat(afExportsValue, "/*"))) {
137
146
  return {
138
147
  key: "".concat(afExportsKey, "/*"),
139
148
  expectedValue: "".concat(afExportsValue, "/*")