@atlaskit/editor-plugin-code-block 14.1.11 → 14.1.13

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/editor-plugin-code-block
2
2
 
3
+ ## 14.1.13
4
+
5
+ ### Patch Changes
6
+
7
+ - [`c2986ab2c7a01`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c2986ab2c7a01) -
8
+ Cleans up prefer static regex violations and enables e18e rule
9
+ - Updated dependencies
10
+
11
+ ## 14.1.12
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 14.1.11
4
18
 
5
19
  ### Patch Changes
package/compass.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  configVersion: 1
2
2
  id: ari:cloud:compass:a436116f-02ce-4520-8fbb-7301462a1674:component/c5751cc6-3513-4070-9deb-af31e86aed34/38dbb0db-0e27-458c-9ff7-4230a2aaecde
3
3
  name: '@atlaskit/editor-plugin-code-block'
4
- ownerId: ari:cloud:identity::team/e611522d-1773-43e4-85a5-e62f7cde47d6 # Editor - Core Experiences
4
+ ownerId: ari:cloud:identity::team/0250ee69-f755-47fd-a468-bf8a9d10a3c5 # Editor AI
5
5
  labels:
6
6
  - platform-code
7
7
  - platform-afm
@@ -24,6 +24,9 @@ customFields:
24
24
  - name: Department
25
25
  type: text
26
26
  value: Eng - Editor
27
+ - name: Trusted Reviewer Teams
28
+ type: text
29
+ value: ari:cloud:identity::team/cf6a670b-5252-4c68-a769-9207de366beb
27
30
  - name: Technical Owner
28
31
  type: user
29
32
  value: ari:cloud:identity::user/612646c53fe26c00694fbe6a # Chris Kimber
@@ -40,6 +40,8 @@ var TS_IMPORT_EXPORT_TYPE_REGEX = /\bimport\s+type\b|\bexport\s+type\b/;
40
40
  var TS_TYPED_VAR_REGEX = /\b(?:const|let|var)\s+[\w$]+\s*:\s*[A-Za-z_$][\w$<>|\[\],\s]*/;
41
41
  var TS_RETURN_TYPE_REGEX = /\)\s*:\s*(?:Promise<)?[A-Za-z_$][\w$<>|\[\],\s]*(?:>|\s)?\s*=>?\s*[{;]/;
42
42
  var TS_ADVANCED_REGEX = /\b(?:as\s+const|implements\s+[A-Z_$]|enum\s+[A-Z_$])/;
43
+ var TS_ACCESS_MODIFIER_REGEX = /\b(?:private|protected|public|readonly)\s+[\w$]+\s*=/;
44
+ var TS_TYPED_ARROW_PARAM_REGEX = /\([^)]{0,500}\b[\w$]+\??:\s*[A-Za-z_$][\w$<>{}\[\]|&,\s.?]{0,200}[^)]{0,500}\)\s*(?::\s*[A-Za-z_$][\w$<>{}\[\]|&,\s.?]{0,200})?\s*=>/;
43
45
 
44
46
  // javascript regexes
45
47
  var JS_VAR_REGEX = /\b(?:const|let|var)\s+[\w$]+\s*=/;
@@ -101,10 +103,12 @@ var scorePatterns = function scorePatterns(code, patterns) {
101
103
  }, 0);
102
104
  };
103
105
  var scoreEnhancedTypeScriptPatterns = function scoreEnhancedTypeScriptPatterns(code) {
104
- return (0, _platformFeatureFlags.fg)('platform_editor_code_block_dogfooding_patch') ? scorePatterns(code, [[/\b(?:private|protected|public|readonly)\s+[\w$]+\s*=/, 5], [/\([^)]{0,500}\b[\w$]+\??:\s*[A-Za-z_$][\w$<>{}\[\]|&,\s.?]{0,200}[^)]{0,500}\)\s*(?::\s*[A-Za-z_$][\w$<>{}\[\]|&,\s.?]{0,200})?\s*=>/, 5]]) : 0;
106
+ return (0, _platformFeatureFlags.fg)('platform_editor_code_block_dogfooding_patch') ? scorePatterns(code, [[TS_ACCESS_MODIFIER_REGEX, 5], [TS_TYPED_ARROW_PARAM_REGEX, 5]]) : 0;
105
107
  };
106
108
  var looksLikeHtmlTagPair = function looksLikeHtmlTagPair(code) {
107
109
  var openTags = new Set();
110
+ // Ignored via go/ees019
111
+ // eslint-disable-next-line e18e/prefer-static-regex
108
112
  var tagPattern = /<\/?([a-z][a-z0-9-]*)\b[^<>]{0,500}>/gi;
109
113
  var match;
110
114
  while ((match = tagPattern.exec(code)) !== null) {
@@ -30,6 +30,8 @@ const TS_IMPORT_EXPORT_TYPE_REGEX = /\bimport\s+type\b|\bexport\s+type\b/;
30
30
  const TS_TYPED_VAR_REGEX = /\b(?:const|let|var)\s+[\w$]+\s*:\s*[A-Za-z_$][\w$<>|\[\],\s]*/;
31
31
  const TS_RETURN_TYPE_REGEX = /\)\s*:\s*(?:Promise<)?[A-Za-z_$][\w$<>|\[\],\s]*(?:>|\s)?\s*=>?\s*[{;]/;
32
32
  const TS_ADVANCED_REGEX = /\b(?:as\s+const|implements\s+[A-Z_$]|enum\s+[A-Z_$])/;
33
+ const TS_ACCESS_MODIFIER_REGEX = /\b(?:private|protected|public|readonly)\s+[\w$]+\s*=/;
34
+ const TS_TYPED_ARROW_PARAM_REGEX = /\([^)]{0,500}\b[\w$]+\??:\s*[A-Za-z_$][\w$<>{}\[\]|&,\s.?]{0,200}[^)]{0,500}\)\s*(?::\s*[A-Za-z_$][\w$<>{}\[\]|&,\s.?]{0,200})?\s*=>/;
33
35
 
34
36
  // javascript regexes
35
37
  const JS_VAR_REGEX = /\b(?:const|let|var)\s+[\w$]+\s*=/;
@@ -83,9 +85,11 @@ const hasPattern = (code, pattern) => {
83
85
  return pattern.test(code);
84
86
  };
85
87
  const scorePatterns = (code, patterns) => patterns.reduce((score, [pattern, value]) => score + (hasPattern(code, pattern) ? value : 0), 0);
86
- const scoreEnhancedTypeScriptPatterns = code => fg('platform_editor_code_block_dogfooding_patch') ? scorePatterns(code, [[/\b(?:private|protected|public|readonly)\s+[\w$]+\s*=/, 5], [/\([^)]{0,500}\b[\w$]+\??:\s*[A-Za-z_$][\w$<>{}\[\]|&,\s.?]{0,200}[^)]{0,500}\)\s*(?::\s*[A-Za-z_$][\w$<>{}\[\]|&,\s.?]{0,200})?\s*=>/, 5]]) : 0;
88
+ const scoreEnhancedTypeScriptPatterns = code => fg('platform_editor_code_block_dogfooding_patch') ? scorePatterns(code, [[TS_ACCESS_MODIFIER_REGEX, 5], [TS_TYPED_ARROW_PARAM_REGEX, 5]]) : 0;
87
89
  const looksLikeHtmlTagPair = code => {
88
90
  const openTags = new Set();
91
+ // Ignored via go/ees019
92
+ // eslint-disable-next-line e18e/prefer-static-regex
89
93
  const tagPattern = /<\/?([a-z][a-z0-9-]*)\b[^<>]{0,500}>/gi;
90
94
  let match;
91
95
  while ((match = tagPattern.exec(code)) !== null) {
@@ -32,6 +32,8 @@ var TS_IMPORT_EXPORT_TYPE_REGEX = /\bimport\s+type\b|\bexport\s+type\b/;
32
32
  var TS_TYPED_VAR_REGEX = /\b(?:const|let|var)\s+[\w$]+\s*:\s*[A-Za-z_$][\w$<>|\[\],\s]*/;
33
33
  var TS_RETURN_TYPE_REGEX = /\)\s*:\s*(?:Promise<)?[A-Za-z_$][\w$<>|\[\],\s]*(?:>|\s)?\s*=>?\s*[{;]/;
34
34
  var TS_ADVANCED_REGEX = /\b(?:as\s+const|implements\s+[A-Z_$]|enum\s+[A-Z_$])/;
35
+ var TS_ACCESS_MODIFIER_REGEX = /\b(?:private|protected|public|readonly)\s+[\w$]+\s*=/;
36
+ var TS_TYPED_ARROW_PARAM_REGEX = /\([^)]{0,500}\b[\w$]+\??:\s*[A-Za-z_$][\w$<>{}\[\]|&,\s.?]{0,200}[^)]{0,500}\)\s*(?::\s*[A-Za-z_$][\w$<>{}\[\]|&,\s.?]{0,200})?\s*=>/;
35
37
 
36
38
  // javascript regexes
37
39
  var JS_VAR_REGEX = /\b(?:const|let|var)\s+[\w$]+\s*=/;
@@ -93,10 +95,12 @@ var scorePatterns = function scorePatterns(code, patterns) {
93
95
  }, 0);
94
96
  };
95
97
  var scoreEnhancedTypeScriptPatterns = function scoreEnhancedTypeScriptPatterns(code) {
96
- return fg('platform_editor_code_block_dogfooding_patch') ? scorePatterns(code, [[/\b(?:private|protected|public|readonly)\s+[\w$]+\s*=/, 5], [/\([^)]{0,500}\b[\w$]+\??:\s*[A-Za-z_$][\w$<>{}\[\]|&,\s.?]{0,200}[^)]{0,500}\)\s*(?::\s*[A-Za-z_$][\w$<>{}\[\]|&,\s.?]{0,200})?\s*=>/, 5]]) : 0;
98
+ return fg('platform_editor_code_block_dogfooding_patch') ? scorePatterns(code, [[TS_ACCESS_MODIFIER_REGEX, 5], [TS_TYPED_ARROW_PARAM_REGEX, 5]]) : 0;
97
99
  };
98
100
  var looksLikeHtmlTagPair = function looksLikeHtmlTagPair(code) {
99
101
  var openTags = new Set();
102
+ // Ignored via go/ees019
103
+ // eslint-disable-next-line e18e/prefer-static-regex
100
104
  var tagPattern = /<\/?([a-z][a-z0-9-]*)\b[^<>]{0,500}>/gi;
101
105
  var match;
102
106
  while ((match = tagPattern.exec(code)) !== null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-code-block",
3
- "version": "14.1.11",
3
+ "version": "14.1.13",
4
4
  "description": "Code block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -42,13 +42,13 @@
42
42
  "@atlaskit/primitives": "^20.3.0",
43
43
  "@atlaskit/prosemirror-input-rules": "^4.0.0",
44
44
  "@atlaskit/select": "^22.3.0",
45
- "@atlaskit/tmp-editor-statsig": "^119.0.0",
45
+ "@atlaskit/tmp-editor-statsig": "^120.1.0",
46
46
  "@atlaskit/tokens": "^15.3.0",
47
47
  "@babel/runtime": "^7.0.0",
48
48
  "@compiled/react": "^0.20.0"
49
49
  },
50
50
  "peerDependencies": {
51
- "@atlaskit/editor-common": "^116.19.0",
51
+ "@atlaskit/editor-common": "^116.21.0",
52
52
  "react": "^18.2.0",
53
53
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
54
54
  },