@atlaskit/adf-schema 56.0.14 → 56.0.16

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,18 @@
1
1
  # @atlaskit/adf-schema
2
2
 
3
+ ## 56.0.16
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 56.0.15
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
+
3
16
  ## 56.0.14
4
17
 
5
18
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "56.0.14",
3
+ "version": "56.0.16",
4
4
  "description": "Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -40,7 +40,7 @@
40
40
  "@atlaskit/adf-schema-generator": "^3.1.0",
41
41
  "@atlaskit/editor-prosemirror": "^8.0.0",
42
42
  "@atlaskit/platform-feature-flags": "^2.0.0",
43
- "@atlaskit/tmp-editor-statsig": "^120.0.0",
43
+ "@atlaskit/tmp-editor-statsig": "^121.0.0",
44
44
  "@babel/runtime": "^7.0.0",
45
45
  "css-color-names": "0.0.4",
46
46
  "linkify-it": "^3.0.3",
@@ -3,6 +3,8 @@ import { adfToValidatorSpec } from '@atlaskit/adf-schema-generator';
3
3
  import adfNode from '../src/next-schema/full-schema.adf';
4
4
  import { writeToFile } from './helpers/writeToFile';
5
5
 
6
+ const VALID_JS_IDENTIFIER_REGEX = /^[a-zA-Z_$][\w$]*$/u;
7
+
6
8
  const outputPath = path.join('src', 'validator-schema', 'generated');
7
9
 
8
10
  const indent = (level: number) => '\n' + ' '.repeat(level);
@@ -55,7 +57,7 @@ function serializeValidatorJson(value: unknown, depth = 0): string {
55
57
  }
56
58
  const inner = entries
57
59
  .map(([k, v]) => {
58
- const keyName = /^[a-zA-Z_$][\w$]*$/u.test(k) ? k : JSON.stringify(k);
60
+ const keyName = VALID_JS_IDENTIFIER_REGEX.test(k) ? k : JSON.stringify(k);
59
61
  return `${keyName}: ${serializeValidatorJson(v, depth + 1)}`;
60
62
  })
61
63
  .join(`,${indent(depth + 1)}`);
@@ -139,7 +141,7 @@ function serializeValidatorType(value: unknown, depth = 0, siblings: unknown[] =
139
141
  const sortedKeys = [...allKeys].sort((a, b) => a.localeCompare(b));
140
142
  const inner = sortedKeys
141
143
  .map((k) => {
142
- const keyName = /^[a-zA-Z_$][\w$]*$/u.test(k) ? k : JSON.stringify(k);
144
+ const keyName = VALID_JS_IDENTIFIER_REGEX.test(k) ? k : JSON.stringify(k);
143
145
  if (k in selfRecord) {
144
146
  const siblingsForK = siblingObjects.filter((s) => k in s).map((s) => s[k]);
145
147
  return `${keyName}: ${serializeValidatorType(selfRecord[k], depth + 1, siblingsForK)}`;
@@ -1,3 +1,6 @@
1
+ const NEXT_SCHEMA_FILES_PATTERN = /.*\/adf-schema\/packages\/adf-schema\/src\/next-schema\/.*/u;
2
+ const SCHEMA_FILES_PATTERN = /.*\/adf-schema\/packages\/adf-schema\/src\/schema\/.*/u;
3
+
1
4
  module.exports = {
2
5
  meta: {
3
6
  type: 'suggestion',
@@ -8,8 +11,8 @@ module.exports = {
8
11
  },
9
12
  create(context) {
10
13
  const { filename } = context;
11
- const nextSchemaFilesPattern = /.*\/adf-schema\/packages\/adf-schema\/src\/next-schema\/.*/u;
12
- const schemaFilesPattern = /.*\/adf-schema\/packages\/adf-schema\/src\/schema\/.*/u;
14
+ const nextSchemaFilesPattern = NEXT_SCHEMA_FILES_PATTERN;
15
+ const schemaFilesPattern = SCHEMA_FILES_PATTERN;
13
16
 
14
17
  const isInSchemaOrNextSchema =
15
18
  filename.match(nextSchemaFilesPattern) || filename.match(schemaFilesPattern);