@atlaskit/editor-plugin-code-block 14.1.12 → 14.1.14

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.14
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 14.1.13
10
+
11
+ ### Patch Changes
12
+
13
+ - [`c2986ab2c7a01`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c2986ab2c7a01) -
14
+ Cleans up prefer static regex violations and enables e18e rule
15
+ - Updated dependencies
16
+
3
17
  ## 14.1.12
4
18
 
5
19
  ### Patch Changes
@@ -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.12",
3
+ "version": "14.1.14",
4
4
  "description": "Code block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -37,18 +37,18 @@
37
37
  "@atlaskit/editor-toolbar": "^2.1.0",
38
38
  "@atlaskit/flag": "^18.1.0",
39
39
  "@atlaskit/frontend-utilities": "^4.1.0",
40
- "@atlaskit/icon": "^36.1.0",
40
+ "@atlaskit/icon": "^36.2.0",
41
41
  "@atlaskit/platform-feature-flags": "^2.0.0",
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": "^120.0.0",
46
- "@atlaskit/tokens": "^15.3.0",
45
+ "@atlaskit/tmp-editor-statsig": "^121.0.0",
46
+ "@atlaskit/tokens": "^15.4.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.20.0",
51
+ "@atlaskit/editor-common": "^116.22.0",
52
52
  "react": "^18.2.0",
53
53
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
54
54
  },