@atlaskit/eslint-plugin-platform 0.5.0 → 0.6.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/eslint-plugin-platform
2
2
 
3
+ ## 0.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#83116](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/83116) [`8d4e99057fe0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8d4e99057fe0) - Upgrade Typescript from `4.9.5` to `5.4.2`
8
+
9
+ ## 0.6.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#82550](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/82550) [`f0948af9e586`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f0948af9e586) - Allow typescript upgrade to 5.x
14
+
3
15
  ## 0.5.0
4
16
 
5
17
  ### Minor Changes
@@ -12,8 +12,9 @@ var _handleAstObject = require("../util/handle-ast-object");
12
12
 
13
13
  // Here we only need to specify the major and minor versions
14
14
  // In matchMinorVersion, we will check if the versions in resolutions fall in the right ranges.
15
+ //
15
16
  var DESIRED_PKG_VERSIONS = {
16
- typescript: ['4.9'],
17
+ typescript: ['5.4'],
17
18
  '@types/react': ['16.14', '18.2']
18
19
  };
19
20
  var matchMinorVersion = function matchMinorVersion(desiredVersion, versionInResolutions) {
@@ -40,22 +40,19 @@ var rule = {
40
40
  var _getMetadataForFilena = (0, _registrationUtils.getMetadataForFilename)(fileName),
41
41
  packageJson = _getMetadataForFilena.pkgJson;
42
42
  var pkgName = packageJson.name;
43
-
44
- // TODO: remove '|| !packageJson['exports']' once all package.json files have 'exports'
45
- if (!pkgName || !packageJson['af:exports'] || !packageJson['exports']) {
43
+ if (!pkgName || !packageJson['af:exports']) {
44
+ return {};
45
+ }
46
+ if (!packageJson['exports']) {
47
+ context.report({
48
+ node: context.getSourceCode().ast,
49
+ messageId: 'missingExportsProperty',
50
+ data: {
51
+ pkgName: pkgName
52
+ }
53
+ });
46
54
  return {};
47
55
  }
48
-
49
- // TODO: Add back in once all package.json files have 'exports'
50
- // if (!packageJson['exports']) {
51
- // context.report({
52
- // node: context.getSourceCode().ast,
53
- // messageId: 'missingExportsProperty',
54
- // data: { pkgName },
55
- // });
56
- // return {};
57
- // }
58
-
59
56
  var afExports = packageJson['af:exports'];
60
57
  var nativeExports = packageJson['exports'];
61
58
  return {
@@ -5,8 +5,9 @@ import { getObjectPropertyAsObject } from '../util/handle-ast-object';
5
5
 
6
6
  // Here we only need to specify the major and minor versions
7
7
  // In matchMinorVersion, we will check if the versions in resolutions fall in the right ranges.
8
+ //
8
9
  const DESIRED_PKG_VERSIONS = {
9
- typescript: ['4.9'],
10
+ typescript: ['5.4'],
10
11
  '@types/react': ['16.14', '18.2']
11
12
  };
12
13
  const matchMinorVersion = (desiredVersion, versionInResolutions) => {
@@ -30,22 +30,19 @@ const rule = {
30
30
  pkgJson: packageJson
31
31
  } = getMetadataForFilename(fileName);
32
32
  const pkgName = packageJson.name;
33
-
34
- // TODO: remove '|| !packageJson['exports']' once all package.json files have 'exports'
35
- if (!pkgName || !packageJson['af:exports'] || !packageJson['exports']) {
33
+ if (!pkgName || !packageJson['af:exports']) {
34
+ return {};
35
+ }
36
+ if (!packageJson['exports']) {
37
+ context.report({
38
+ node: context.getSourceCode().ast,
39
+ messageId: 'missingExportsProperty',
40
+ data: {
41
+ pkgName
42
+ }
43
+ });
36
44
  return {};
37
45
  }
38
-
39
- // TODO: Add back in once all package.json files have 'exports'
40
- // if (!packageJson['exports']) {
41
- // context.report({
42
- // node: context.getSourceCode().ast,
43
- // messageId: 'missingExportsProperty',
44
- // data: { pkgName },
45
- // });
46
- // return {};
47
- // }
48
-
49
46
  const afExports = packageJson['af:exports'];
50
47
  const nativeExports = packageJson['exports'];
51
48
  return {
@@ -6,8 +6,9 @@ import { getObjectPropertyAsObject } from '../util/handle-ast-object';
6
6
 
7
7
  // Here we only need to specify the major and minor versions
8
8
  // In matchMinorVersion, we will check if the versions in resolutions fall in the right ranges.
9
+ //
9
10
  var DESIRED_PKG_VERSIONS = {
10
- typescript: ['4.9'],
11
+ typescript: ['5.4'],
11
12
  '@types/react': ['16.14', '18.2']
12
13
  };
13
14
  var matchMinorVersion = function matchMinorVersion(desiredVersion, versionInResolutions) {
@@ -33,22 +33,19 @@ var rule = {
33
33
  var _getMetadataForFilena = getMetadataForFilename(fileName),
34
34
  packageJson = _getMetadataForFilena.pkgJson;
35
35
  var pkgName = packageJson.name;
36
-
37
- // TODO: remove '|| !packageJson['exports']' once all package.json files have 'exports'
38
- if (!pkgName || !packageJson['af:exports'] || !packageJson['exports']) {
36
+ if (!pkgName || !packageJson['af:exports']) {
37
+ return {};
38
+ }
39
+ if (!packageJson['exports']) {
40
+ context.report({
41
+ node: context.getSourceCode().ast,
42
+ messageId: 'missingExportsProperty',
43
+ data: {
44
+ pkgName: pkgName
45
+ }
46
+ });
39
47
  return {};
40
48
  }
41
-
42
- // TODO: Add back in once all package.json files have 'exports'
43
- // if (!packageJson['exports']) {
44
- // context.report({
45
- // node: context.getSourceCode().ast,
46
- // messageId: 'missingExportsProperty',
47
- // data: { pkgName },
48
- // });
49
- // return {};
50
- // }
51
-
52
49
  var afExports = packageJson['af:exports'];
53
50
  var nativeExports = packageJson['exports'];
54
51
  return {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@atlaskit/eslint-plugin-platform",
3
3
  "description": "The essential plugin for use with Atlassian frontend platform tools",
4
- "version": "0.5.0",
4
+ "version": "0.6.1",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "atlassian": {
7
7
  "team": "UIP - Platform Integration Trust (PITa)",
@@ -42,4 +42,4 @@
42
42
  "tsconfig-paths": "^4.2.0"
43
43
  },
44
44
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
45
- }
45
+ }
@@ -11,7 +11,7 @@ describe('test ensure-critical-dependency-resolutions rule', () => {
11
11
  code: `const foo = {
12
12
  "resolutions": {
13
13
  "@types/react": "16.14.15",
14
- "typescript": "4.9.5",
14
+ "typescript": "5.4.2",
15
15
  }
16
16
  }`,
17
17
  filename: `${cwd}/package.json`,
@@ -21,7 +21,7 @@ describe('test ensure-critical-dependency-resolutions rule', () => {
21
21
  code: `const foo = {
22
22
  "resolutions": {
23
23
  "@types/react": "18.2.28",
24
- "typescript": "4.9.5",
24
+ "typescript": "5.4.2",
25
25
  }
26
26
  }`,
27
27
  filename: `${cwd}/package.json`,
@@ -31,7 +31,7 @@ describe('test ensure-critical-dependency-resolutions rule', () => {
31
31
  code: `const foo = {
32
32
  "resolutions": {
33
33
  "@types/react": "~16.14.25",
34
- "typescript": "~4.9.8",
34
+ "typescript": "~5.4.2",
35
35
  }
36
36
  }`,
37
37
  filename: `${cwd}/package.json`,
@@ -60,7 +60,7 @@ describe('test ensure-critical-dependency-resolutions rule', () => {
60
60
  {
61
61
  code: `const foo = {
62
62
  "resolutions": {
63
- "typescript": "~4.9.8",
63
+ "typescript": "~5.4.2",
64
64
  }
65
65
  }`,
66
66
  filename: `${cwd}/package.json`,
@@ -75,7 +75,7 @@ describe('test ensure-critical-dependency-resolutions rule', () => {
75
75
  code: `const foo = {
76
76
  "resolutions": {
77
77
  "@types/react": "16.8.25",
78
- "typescript": "4.5.8",
78
+ "typescript": "5.1.1",
79
79
  }
80
80
  }`,
81
81
  filename: `${cwd}/package.json`,
@@ -90,7 +90,7 @@ describe('test ensure-critical-dependency-resolutions rule', () => {
90
90
  code: `const foo = {
91
91
  "resolutions": {
92
92
  "@types/react": "~16.14.25",
93
- "typescript": "~4.5.8",
93
+ "typescript": "~5.1.1",
94
94
  }
95
95
  }`,
96
96
  filename: `${cwd}/package.json`,
@@ -105,7 +105,7 @@ describe('test ensure-critical-dependency-resolutions rule', () => {
105
105
  code: `const foo = {
106
106
  "resolutions": {
107
107
  "@types/react": "~16.14.25",
108
- "typescript": "^4.9.5",
108
+ "typescript": "^5.4.2",
109
109
  }
110
110
  }`,
111
111
  filename: `${cwd}/package.json`,
@@ -120,7 +120,7 @@ describe('test ensure-critical-dependency-resolutions rule', () => {
120
120
  code: `const foo = {
121
121
  "resolutions": {
122
122
  "@types/react": "16.14.15",
123
- "typescript": "4.5.8",
123
+ "typescript": "5.1.1",
124
124
  }
125
125
  }`,
126
126
  filename: `${cwd}/packages/packge/directory/package.json`,
@@ -6,8 +6,9 @@ import { getObjectPropertyAsObject } from '../util/handle-ast-object';
6
6
 
7
7
  // Here we only need to specify the major and minor versions
8
8
  // In matchMinorVersion, we will check if the versions in resolutions fall in the right ranges.
9
+ //
9
10
  const DESIRED_PKG_VERSIONS: Record<string, string[]> = {
10
- typescript: ['4.9'],
11
+ typescript: ['5.4'],
11
12
  '@types/react': ['16.14', '18.2'],
12
13
  };
13
14
 
@@ -41,20 +41,18 @@ const rule: Rule.RuleModule = {
41
41
 
42
42
  const pkgName = packageJson.name;
43
43
 
44
- // TODO: remove '|| !packageJson['exports']' once all package.json files have 'exports'
45
- if (!pkgName || !packageJson['af:exports'] || !packageJson['exports']) {
44
+ if (!pkgName || !packageJson['af:exports']) {
46
45
  return {};
47
46
  }
48
47
 
49
- // TODO: Add back in once all package.json files have 'exports'
50
- // if (!packageJson['exports']) {
51
- // context.report({
52
- // node: context.getSourceCode().ast,
53
- // messageId: 'missingExportsProperty',
54
- // data: { pkgName },
55
- // });
56
- // return {};
57
- // }
48
+ if (!packageJson['exports']) {
49
+ context.report({
50
+ node: context.getSourceCode().ast,
51
+ messageId: 'missingExportsProperty',
52
+ data: { pkgName },
53
+ });
54
+ return {};
55
+ }
58
56
 
59
57
  const afExports: { [key: string]: any } = packageJson['af:exports'];
60
58
  const nativeExports: { [key: string]: any } = packageJson['exports'];