eslint-config-seek 7.0.9 → 9.0.0

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.
@@ -0,0 +1,8 @@
1
+ # Changesets
2
+
3
+ Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4
+ with multi-package repos, or single-package repos to help you version and publish your code. You can
5
+ find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6
+
7
+ We have a quick list of common questions to get you started engaging with this project in
8
+ [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
@@ -0,0 +1,162 @@
1
+ const {
2
+ getInfo,
3
+ getInfoFromPullRequest,
4
+ } = require('@changesets/get-github-info');
5
+
6
+ /**
7
+ * Adapted from `@changesets/cli`.
8
+ *
9
+ * {@link https://github.com/atlassian/changesets/blob/%40changesets/cli%402.17.0/packages/cli/src/changelog/index.ts}
10
+ *
11
+ * @type import('@changesets/types').ChangelogFunctions
12
+ */
13
+ const defaultChangelogFunctions = {
14
+ getDependencyReleaseLine: async (changesets, dependenciesUpdated) => {
15
+ if (dependenciesUpdated.length === 0) return '';
16
+
17
+ const changesetLinks = changesets.map(
18
+ (changeset) => `- Updated dependencies [${changeset.commit}]`,
19
+ );
20
+
21
+ const updatedDependenciesList = dependenciesUpdated.map(
22
+ (dependency) => ` - ${dependency.name}@${dependency.newVersion}`,
23
+ );
24
+
25
+ return [...changesetLinks, ...updatedDependenciesList].join('\n');
26
+ },
27
+ getReleaseLine: async (changeset) => {
28
+ const [firstLine, ...futureLines] = changeset.summary
29
+ .split('\n')
30
+ .map((l) => l.trimRight());
31
+
32
+ const suffix = changeset.commit;
33
+
34
+ return `\n\n- ${firstLine}${suffix ? ` (${suffix})` : ''}\n${futureLines
35
+ .map((l) => ` ${l}`)
36
+ .join('\n')}`;
37
+ },
38
+ };
39
+
40
+ /**
41
+ * Adapted from `@changesets/changelog-github`.
42
+ *
43
+ * {@link https://github.com/atlassian/changesets/blob/%40changesets/changelog-github%400.4.1/packages/changelog-github/src/index.ts}
44
+ *
45
+ * @type import('@changesets/types').ChangelogFunctions
46
+ */
47
+ const gitHubChangelogFunctions = {
48
+ getDependencyReleaseLine: async (
49
+ changesets,
50
+ dependenciesUpdated,
51
+ options,
52
+ ) => {
53
+ if (!options.repo) {
54
+ throw new Error(
55
+ 'Please provide a repo to this changelog generator like this:\n"changelog": ["./changelog.js", { "repo": "org/repo" }]',
56
+ );
57
+ }
58
+ if (dependenciesUpdated.length === 0) return '';
59
+
60
+ const changesetLink = `- Updated dependencies [${(
61
+ await Promise.all(
62
+ changesets.map(async (cs) => {
63
+ if (cs.commit) {
64
+ let { links } = await getInfo({
65
+ repo: options.repo,
66
+ commit: cs.commit,
67
+ });
68
+ return links.commit;
69
+ }
70
+ }),
71
+ )
72
+ )
73
+ .filter((_) => _)
74
+ .join(', ')}]:`;
75
+
76
+ const updatedDependenciesList = dependenciesUpdated.map(
77
+ (dependency) => ` - ${dependency.name}@${dependency.newVersion}`,
78
+ );
79
+
80
+ return [changesetLink, ...updatedDependenciesList].join('\n');
81
+ },
82
+ getReleaseLine: async (changeset, _type, options) => {
83
+ if (!options || !options.repo) {
84
+ throw new Error(
85
+ 'Please provide a repo to this changelog generator like this:\n"changelog": ["./changelog.js", { "repo": "org/repo" }]',
86
+ );
87
+ }
88
+
89
+ /** @type number | undefined */
90
+ let prFromSummary;
91
+ /** @type string | undefined */
92
+ let commitFromSummary;
93
+
94
+ const replacedChangelog = changeset.summary
95
+ .replace(/^\s*(?:pr|pull|pull\s+request):\s*#?(\d+)/im, (_, pr) => {
96
+ let num = Number(pr);
97
+ if (!isNaN(num)) prFromSummary = num;
98
+ return '';
99
+ })
100
+ .replace(/^\s*commit:\s*([^\s]+)/im, (_, commit) => {
101
+ commitFromSummary = commit;
102
+ return '';
103
+ })
104
+ .replace(/^\s*(?:author|user):\s*@?([^\s]+)/gim, (_, user) => {
105
+ usersFromSummary.push(user);
106
+ return '';
107
+ })
108
+ .trim();
109
+
110
+ const [firstLine, ...futureLines] = replacedChangelog
111
+ .split('\n')
112
+ .map((l) => l.trimRight());
113
+
114
+ const links = await (async () => {
115
+ if (prFromSummary !== undefined) {
116
+ let { links } = await getInfoFromPullRequest({
117
+ repo: options.repo,
118
+ pull: prFromSummary,
119
+ });
120
+ if (commitFromSummary) {
121
+ links = {
122
+ ...links,
123
+ commit: `[\`${commitFromSummary}\`](https://github.com/${options.repo}/commit/${commitFromSummary})`,
124
+ };
125
+ }
126
+ return links;
127
+ }
128
+ const commitToFetchFrom = commitFromSummary || changeset.commit;
129
+ if (commitToFetchFrom) {
130
+ let { links } = await getInfo({
131
+ repo: options.repo,
132
+ commit: commitToFetchFrom,
133
+ });
134
+ return links;
135
+ }
136
+ return {
137
+ commit: null,
138
+ pull: null,
139
+ user: null,
140
+ };
141
+ })();
142
+
143
+ const suffix = links.pull ?? links.commit;
144
+
145
+ return [
146
+ `\n- ${firstLine}${suffix ? ` (${suffix})` : ''}`,
147
+ ...futureLines.map((l) => ` ${l}`),
148
+ ].join('\n');
149
+ },
150
+ };
151
+
152
+ if (process.env.GITHUB_TOKEN) {
153
+ module.exports = gitHubChangelogFunctions;
154
+ } else {
155
+ console.warn(
156
+ `Defaulting to Git-based versioning.
157
+ Enable GitHub-based versioning by setting the GITHUB_TOKEN environment variable.
158
+ This requires a GitHub personal access token with the \`public_repo\` scope: https://github.com/settings/tokens/new`,
159
+ );
160
+
161
+ module.exports = defaultChangelogFunctions;
162
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "$schema": "https://unpkg.com/@changesets/config@1.6.1/schema.json",
3
+ "changelog": ["./changelog.js", { "repo": "seek-oss/eslint-config-seek" }],
4
+ "commit": false,
5
+ "linked": [],
6
+ "access": "public",
7
+ "baseBranch": "master",
8
+ "updateInternalDependencies": "patch",
9
+ "ignore": []
10
+ }
package/.eslintrc.js CHANGED
@@ -70,7 +70,10 @@ const baseRules = {
70
70
  'prefer-const': ERROR,
71
71
  'prefer-spread': ERROR,
72
72
  'prefer-template': ERROR,
73
- 'no-return-await': ERROR,
73
+ // Allow devs to choose between performance and richer stack traces
74
+ // https://eslint.org/docs/rules/no-return-await#when-not-to-use-it
75
+ // https://github.com/goldbergyoni/nodebestpractices/blob/master@%7B2022-01-01T00:00:00Z%7D/sections/errorhandling/returningpromises.md
76
+ 'no-return-await': OFF,
74
77
  };
75
78
 
76
79
  const reactRules = {
@@ -85,10 +88,13 @@ const reactRules = {
85
88
  };
86
89
 
87
90
  const baseConfig = {
88
- parser: 'babel-eslint',
91
+ parser: '@babel/eslint-parser',
89
92
  parserOptions: {
93
+ babelOptions: {
94
+ presets: ['@babel/preset-react'],
95
+ },
96
+ requireConfigFile: false,
90
97
  sourceType: 'module',
91
- ecmaFeatures: { jsx: true },
92
98
  },
93
99
  root: true,
94
100
  env: {
@@ -97,15 +103,11 @@ const baseConfig = {
97
103
  },
98
104
  settings: {
99
105
  react: {
100
- version: '>16',
106
+ version: 'detect',
101
107
  },
102
108
  },
103
- plugins: ['react', 'react-hooks', 'css-modules'],
104
- extends: [
105
- 'plugin:css-modules/recommended',
106
- 'plugin:react/recommended',
107
- 'prettier',
108
- ],
109
+ plugins: ['react', 'react-hooks'],
110
+ extends: ['plugin:react/recommended', 'prettier'],
109
111
  rules: {
110
112
  ...baseRules,
111
113
  ...reactRules,
@@ -122,7 +124,7 @@ const baseConfig = {
122
124
  extends: [
123
125
  'plugin:@typescript-eslint/eslint-recommended',
124
126
  'plugin:@typescript-eslint/recommended',
125
- 'prettier/@typescript-eslint',
127
+ 'prettier',
126
128
  ],
127
129
  rules: {
128
130
  '@typescript-eslint/no-unused-expressions': ERROR,
@@ -141,7 +143,6 @@ const baseConfig = {
141
143
  ERROR,
142
144
  { ignoreParameters: true },
143
145
  ],
144
- '@typescript-eslint/explicit-module-boundary-types': OFF,
145
146
  // prefer TypeScript exhaustiveness checking
146
147
  // https://www.typescriptlang.org/docs/handbook/advanced-types.html#exhaustiveness-checking
147
148
  'default-case': OFF,
@@ -159,7 +160,6 @@ const baseConfig = {
159
160
  es6: true,
160
161
  },
161
162
  extends: [
162
- 'plugin:flowtype/recommended',
163
163
  'plugin:import/errors',
164
164
  'plugin:import/warnings',
165
165
  'plugin:import/typescript',
@@ -171,7 +171,6 @@ const baseConfig = {
171
171
  },
172
172
  },
173
173
  },
174
- plugins: ['flowtype'],
175
174
  rules: {
176
175
  'no-use-before-define': [ERROR, { functions: false }],
177
176
  'no-unused-expressions': ERROR,
@@ -0,0 +1,38 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - beta
7
+ - master
8
+
9
+ jobs:
10
+ release:
11
+ name: Release
12
+ runs-on: ubuntu-latest
13
+ env:
14
+ CI: true
15
+ steps:
16
+ - name: Check out repo
17
+ uses: actions/checkout@main
18
+ with:
19
+ # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
20
+ fetch-depth: 0
21
+ token: ${{ secrets.SEEK_OSS_CI_GITHUB_TOKEN }}
22
+
23
+ - name: Set up Node.js 16.x
24
+ uses: actions/setup-node@main
25
+ with:
26
+ node-version: 16.x
27
+
28
+ - name: Install dependencies
29
+ run: yarn --immutable
30
+
31
+ - name: Release
32
+ uses: changesets/action@v1
33
+ with:
34
+ publish: yarn release
35
+ version: yarn changeset-version
36
+ env:
37
+ GITHUB_TOKEN: ${{ secrets.SEEK_OSS_CI_GITHUB_TOKEN }}
38
+ NPM_TOKEN: ${{ secrets.SEEK_OSS_CI_NPM_TOKEN }}
@@ -0,0 +1,26 @@
1
+ name: Test
2
+
3
+ on:
4
+ - pull_request
5
+ - push
6
+
7
+ jobs:
8
+ test:
9
+ name: Test
10
+ runs-on: ubuntu-latest
11
+ env:
12
+ CI: true
13
+ steps:
14
+ - name: Check out repo
15
+ uses: actions/checkout@main
16
+
17
+ - name: Set up Node.js 16.x
18
+ uses: actions/setup-node@main
19
+ with:
20
+ node-version: 16.x
21
+
22
+ - name: Install dependencies
23
+ run: yarn --immutable
24
+
25
+ - name: Test
26
+ run: yarn test
package/CHANGELOG.md ADDED
@@ -0,0 +1,53 @@
1
+ # eslint-config-seek
2
+
3
+ ## 9.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - Support ESLint 8.x ([#73](https://github.com/seek-oss/eslint-config-seek/pull/73))
8
+
9
+ We've upgraded the parsers and plugins bundled in `eslint-config-seek` for ESLint 8.x compatibility. Some linting rules have changed and may require manual triage. In particular, we've applied the following major upgrades:
10
+
11
+ - [TypeScript ESLint v5](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v5.0.0)
12
+
13
+ This includes changes to the recommended rule set.
14
+
15
+ - [`babel-eslint`](https://www.npmjs.com/package/babel-eslint) → [`@babel/eslint-parser`](https://www.npmjs.com/package/@babel/eslint-parser)
16
+
17
+ This resolves the following installation warning:
18
+
19
+ ```console
20
+ babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
21
+ ```
22
+
23
+ - [`eslint-config-prettier` v8](https://github.com/prettier/eslint-config-prettier/blob/HEAD/CHANGELOG.md?rgh-link-date=2021-10-18T05%3A10%3A39Z#version-800-2021-02-21)
24
+
25
+ This unifies on a single `prettier` config.
26
+
27
+ [`eslint-plugin-cypress`](https://github.com/cypress-io/eslint-plugin-cypress/issues/89) is currently incompatible with ESLint 8.x. Projects that utilise Cypress should remain on ESLint 7.x.
28
+
29
+ ### Minor Changes
30
+
31
+ - Turn off [`no-return-await`](https://eslint.org/docs/rules/no-return-await) ([#74](https://github.com/seek-oss/eslint-config-seek/pull/74))
32
+
33
+ `return await` produces [richer stack traces with a marginal performance penalty](https://github.com/goldbergyoni/nodebestpractices/blob/master@%7B2022-01-01T00:00:00Z%7D/sections/errorhandling/returningpromises.md) in recent Node.js versions. This tradeoff is now left to individual consumers to weigh up and optionally enforce.
34
+
35
+ ## 8.0.0
36
+
37
+ ### Major Changes
38
+
39
+ - Remove support for Flow ([#64](https://github.com/seek-oss/eslint-config-seek/pull/64))
40
+
41
+ SEEK has aligned on [TypeScript](https://www.typescriptlang.org/) for static type checking. [Flow](https://flow.org/) support was similarly removed in [sku 11](https://github.com/seek-oss/sku/releases/tag/v11.0.0).
42
+
43
+ Affected projects should migrate to TypeScript.
44
+
45
+ - Remove support for CSS Modules ([#64](https://github.com/seek-oss/eslint-config-seek/pull/64))
46
+
47
+ [eslint-plugin-css-modules](https://github.com/atfzl/eslint-plugin-css-modules) is unmaintained, and SEEK has since moved on to [vanilla-extract](https://vanilla-extract.style/).
48
+
49
+ Affected projects should migrate to vanilla-extract.
50
+
51
+ ### Patch Changes
52
+
53
+ - Detect the react version ([#68](https://github.com/seek-oss/eslint-config-seek/pull/68))
package/README.md CHANGED
@@ -1,4 +1,5 @@
1
- [![Test & Release](https://github.com/seek-oss/eslint-config-seek/actions/workflows/test-and-release.yml/badge.svg)](https://github.com/seek-oss/eslint-config-seek/actions/workflows/test-and-release.yml)
1
+ [![Test](https://github.com/seek-oss/eslint-config-seek/actions/workflows/test.yml/badge.svg)](https://github.com/seek-oss/eslint-config-seek/actions/workflows/test.yml)
2
+ [![Release](https://github.com/seek-oss/eslint-config-seek/actions/workflows/release.yml/badge.svg)](https://github.com/seek-oss/eslint-config-seek/actions/workflows/release.yml)
2
3
 
3
4
  # eslint-config-seek
4
5
 
package/package.json CHANGED
@@ -1,63 +1,47 @@
1
1
  {
2
2
  "name": "eslint-config-seek",
3
- "version": "7.0.9",
3
+ "version": "9.0.0",
4
4
  "description": "ESLint configuration used by SEEK",
5
5
  "main": ".eslintrc.js",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/seek-oss/eslint-config-seek.git"
9
9
  },
10
- "author": "Seek",
10
+ "author": "SEEK",
11
11
  "license": "MIT",
12
12
  "bugs": {
13
13
  "url": "https://github.com/seek-oss/eslint-config-seek/issues"
14
14
  },
15
15
  "scripts": {
16
+ "release": "changeset publish",
16
17
  "test": "eslint .",
17
- "commit": "git-cz",
18
- "release": "semantic-release"
19
- },
20
- "husky": {
21
- "hooks": {
22
- "commit-msg": "commitlint --edit --extends seek"
23
- }
18
+ "changeset-version": "changeset version && prettier --write ."
24
19
  },
25
20
  "homepage": "https://github.com/seek-oss/eslint-config-seek#readme",
26
21
  "dependencies": {
27
- "@typescript-eslint/eslint-plugin": "^4.8.1",
28
- "@typescript-eslint/parser": "^4.8.1",
29
- "babel-eslint": "^10.1.0",
30
- "eslint-config-prettier": "^6.11.0",
31
- "eslint-import-resolver-node": "^0.3.3",
32
- "eslint-plugin-css-modules": "^2.11.0",
33
- "eslint-plugin-cypress": "^2.11.1",
34
- "eslint-plugin-flowtype": "^5.1.3",
35
- "eslint-plugin-import": "^2.21.2",
36
- "eslint-plugin-jest": "^25.2.2",
37
- "eslint-plugin-react": "^7.20.0",
38
- "eslint-plugin-react-hooks": "^4.0.4",
22
+ "@babel/core": "^7.17.8",
23
+ "@babel/eslint-parser": "^7.17.0",
24
+ "@babel/preset-react": "^7.16.7",
25
+ "@typescript-eslint/eslint-plugin": "^5.16.0",
26
+ "@typescript-eslint/parser": "^5.16.0",
27
+ "eslint-config-prettier": "^8.5.0",
28
+ "eslint-import-resolver-node": "^0.3.6",
29
+ "eslint-plugin-cypress": "^2.12.1",
30
+ "eslint-plugin-import": "^2.25.4",
31
+ "eslint-plugin-jest": "^26.1.2",
32
+ "eslint-plugin-react": "^7.29.4",
33
+ "eslint-plugin-react-hooks": "^4.3.0",
39
34
  "find-root": "^1.1.0"
40
35
  },
41
36
  "devDependencies": {
42
- "@commitlint/cli": "^8.2.0",
43
- "commitizen": "^4.0.3",
44
- "commitlint-config-seek": "^1.0.0",
45
- "cz-conventional-changelog": "^3.0.2",
46
- "eslint": "^7.14.0",
47
- "husky": "^3.1.0",
48
- "semantic-release": "^15.13.31",
37
+ "@changesets/cli": "2.17.0",
38
+ "@changesets/get-github-info": "0.5.0",
39
+ "eslint": "8.11.0",
40
+ "prettier": "2.4.1",
49
41
  "typescript": "^4.1.2"
50
42
  },
51
- "release": {
52
- "success": false
53
- },
54
43
  "peerDependencies": {
55
44
  "eslint": ">=6",
56
45
  "typescript": ">=3.3"
57
- },
58
- "config": {
59
- "commitizen": {
60
- "path": "./node_modules/cz-conventional-changelog"
61
- }
62
46
  }
63
47
  }
@@ -1,34 +0,0 @@
1
- name: Test & Release
2
-
3
- on:
4
- - pull_request
5
- - push
6
-
7
- jobs:
8
- test-and-release:
9
- name: Test & Release
10
- runs-on: ubuntu-latest
11
- env:
12
- CI: true
13
- steps:
14
- - name: Check out repo
15
- uses: actions/checkout@main
16
- with:
17
- lfs: true
18
-
19
- - name: Set up Node.js 14.x
20
- uses: actions/setup-node@main
21
- with:
22
- node-version: 14.x
23
-
24
- - name: Install dependencies
25
- run: yarn --immutable
26
-
27
- - name: Test
28
- run: yarn test
29
-
30
- - name: Release
31
- run: yarn release
32
- env:
33
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34
- NPM_TOKEN: ${{ secrets.SEEK_OSS_CI_NPM_TOKEN }}