eslint-config-seek 7.0.8 → 9.0.0-beta.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
+ }
@@ -0,0 +1,25 @@
1
+ ---
2
+ 'eslint-config-seek': major
3
+ ---
4
+
5
+ Support ESLint 8.x
6
+
7
+ 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:
8
+
9
+ - [TypeScript ESLint v5](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v5.0.0)
10
+
11
+ This includes changes to the recommended rule set.
12
+
13
+ - [`babel-eslint`](https://www.npmjs.com/package/babel-eslint) → [`@babel/eslint-parser`](https://www.npmjs.com/package/@babel/eslint-parser)
14
+
15
+ This resolves the following installation warning:
16
+
17
+ ```console
18
+ babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
19
+ ```
20
+
21
+ - [`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)
22
+
23
+ This unifies on a single `prettier` config.
24
+
25
+ [`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.
@@ -0,0 +1,10 @@
1
+ {
2
+ "mode": "pre",
3
+ "tag": "beta",
4
+ "initialVersions": {
5
+ "eslint-config-seek": "8.0.0"
6
+ },
7
+ "changesets": [
8
+ "olive-seas-collect"
9
+ ]
10
+ }
package/.eslintrc.js CHANGED
@@ -85,10 +85,13 @@ const reactRules = {
85
85
  };
86
86
 
87
87
  const baseConfig = {
88
- parser: 'babel-eslint',
88
+ parser: '@babel/eslint-parser',
89
89
  parserOptions: {
90
+ babelOptions: {
91
+ presets: ['@babel/preset-react'],
92
+ },
93
+ requireConfigFile: false,
90
94
  sourceType: 'module',
91
- ecmaFeatures: { jsx: true },
92
95
  },
93
96
  root: true,
94
97
  env: {
@@ -97,15 +100,11 @@ const baseConfig = {
97
100
  },
98
101
  settings: {
99
102
  react: {
100
- version: '>16',
103
+ version: 'detect',
101
104
  },
102
105
  },
103
- plugins: ['react', 'react-hooks', 'css-modules'],
104
- extends: [
105
- 'plugin:css-modules/recommended',
106
- 'plugin:react/recommended',
107
- 'prettier',
108
- ],
106
+ plugins: ['react', 'react-hooks'],
107
+ extends: ['plugin:react/recommended', 'prettier'],
109
108
  rules: {
110
109
  ...baseRules,
111
110
  ...reactRules,
@@ -122,7 +121,7 @@ const baseConfig = {
122
121
  extends: [
123
122
  'plugin:@typescript-eslint/eslint-recommended',
124
123
  'plugin:@typescript-eslint/recommended',
125
- 'prettier/@typescript-eslint',
124
+ 'prettier',
126
125
  ],
127
126
  rules: {
128
127
  '@typescript-eslint/no-unused-expressions': ERROR,
@@ -141,7 +140,6 @@ const baseConfig = {
141
140
  ERROR,
142
141
  { ignoreParameters: true },
143
142
  ],
144
- '@typescript-eslint/explicit-module-boundary-types': OFF,
145
143
  // prefer TypeScript exhaustiveness checking
146
144
  // https://www.typescriptlang.org/docs/handbook/advanced-types.html#exhaustiveness-checking
147
145
  'default-case': OFF,
@@ -159,7 +157,6 @@ const baseConfig = {
159
157
  es6: true,
160
158
  },
161
159
  extends: [
162
- 'plugin:flowtype/recommended',
163
160
  'plugin:import/errors',
164
161
  'plugin:import/warnings',
165
162
  'plugin:import/typescript',
@@ -171,7 +168,6 @@ const baseConfig = {
171
168
  },
172
169
  },
173
170
  },
174
- plugins: ['flowtype'],
175
171
  rules: {
176
172
  'no-use-before-define': [ERROR, { functions: false }],
177
173
  'no-unused-expressions': ERROR,
@@ -0,0 +1,34 @@
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
+
19
+ - name: Set up Node.js 16.x
20
+ uses: actions/setup-node@main
21
+ with:
22
+ node-version: 16.x
23
+
24
+ - name: Install dependencies
25
+ run: yarn --immutable
26
+
27
+ - name: Release
28
+ uses: changesets/action@v1
29
+ with:
30
+ publish: yarn release
31
+ version: yarn changeset-version
32
+ env:
33
+ GITHUB_TOKEN: ${{ secrets.SEEK_OSS_CI_GITHUB_TOKEN }}
34
+ 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,47 @@
1
+ # eslint-config-seek
2
+
3
+ ## 9.0.0-beta.0
4
+
5
+ ### Major Changes
6
+
7
+ - Support ESLint 8.x (15e26ec)
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
+ ## 8.0.0
30
+
31
+ ### Major Changes
32
+
33
+ - Remove support for Flow ([#64](https://github.com/seek-oss/eslint-config-seek/pull/64))
34
+
35
+ 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).
36
+
37
+ Affected projects should migrate to TypeScript.
38
+
39
+ - Remove support for CSS Modules ([#64](https://github.com/seek-oss/eslint-config-seek/pull/64))
40
+
41
+ [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/).
42
+
43
+ Affected projects should migrate to vanilla-extract.
44
+
45
+ ### Patch Changes
46
+
47
+ - Detect the react version ([#68](https://github.com/seek-oss/eslint-config-seek/pull/68))
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
- [![Build Status](https://img.shields.io/travis/seek-oss/eslint-config-seek/master.svg?style=flat-square)](http://travis-ci.org/seek-oss/eslint-config-seek) [![npm](https://img.shields.io/npm/v/eslint-config-seek.svg?style=flat-square)](https://www.npmjs.com/package/eslint-config-seek) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://github.com/semantic-release/semantic-release) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat-square)](http://commitizen.github.io/cz-cli/)
2
-
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)
3
3
 
4
4
  # eslint-config-seek
5
5
 
package/package.json CHANGED
@@ -1,65 +1,47 @@
1
1
  {
2
2
  "name": "eslint-config-seek",
3
- "version": "7.0.8",
3
+ "version": "9.0.0-beta.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
- "travis-deploy-once": "travis-deploy-once",
19
- "semantic-release": "semantic-release"
20
- },
21
- "husky": {
22
- "hooks": {
23
- "commit-msg": "commitlint --edit --extends seek"
24
- }
18
+ "changeset-version": "changeset version && prettier --write ."
25
19
  },
26
20
  "homepage": "https://github.com/seek-oss/eslint-config-seek#readme",
27
21
  "dependencies": {
28
- "@typescript-eslint/eslint-plugin": "^4.8.1",
29
- "@typescript-eslint/parser": "^4.8.1",
30
- "babel-eslint": "^10.1.0",
31
- "eslint-config-prettier": "^6.11.0",
32
- "eslint-import-resolver-node": "^0.3.3",
33
- "eslint-plugin-css-modules": "^2.11.0",
34
- "eslint-plugin-cypress": "^2.11.1",
35
- "eslint-plugin-flowtype": "^5.1.3",
36
- "eslint-plugin-import": "^2.21.2",
37
- "eslint-plugin-jest": "^24.0.0",
38
- "eslint-plugin-react": "^7.20.0",
39
- "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",
40
34
  "find-root": "^1.1.0"
41
35
  },
42
36
  "devDependencies": {
43
- "@commitlint/cli": "^8.2.0",
44
- "commitizen": "^4.0.3",
45
- "commitlint-config-seek": "^1.0.0",
46
- "cz-conventional-changelog": "^3.0.2",
47
- "eslint": "^7.14.0",
48
- "husky": "^3.1.0",
49
- "semantic-release": "^15.13.31",
50
- "travis-deploy-once": "^5.0.11",
37
+ "@changesets/cli": "2.17.0",
38
+ "@changesets/get-github-info": "0.5.0",
39
+ "eslint": "7.32.0",
40
+ "prettier": "2.4.1",
51
41
  "typescript": "^4.1.2"
52
42
  },
53
- "release": {
54
- "success": false
55
- },
56
43
  "peerDependencies": {
57
44
  "eslint": ">=6",
58
45
  "typescript": ">=3.3"
59
- },
60
- "config": {
61
- "commitizen": {
62
- "path": "./node_modules/cz-conventional-changelog"
63
- }
64
46
  }
65
47
  }
package/.travis.yml DELETED
@@ -1,15 +0,0 @@
1
- language: node_js
2
- cache:
3
- directories:
4
- - node_modules
5
- notifications:
6
- email: false
7
- node_js:
8
- - '10'
9
- before_script:
10
- - npm prune
11
- after_success:
12
- - npm run travis-deploy-once "npm run semantic-release"
13
- branches:
14
- except:
15
- - /^v\d+\.\d+\.\d+$/