eslint-config-seek 10.0.0 → 10.1.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.
package/.eslintrc.js CHANGED
@@ -87,6 +87,7 @@ const reactRules = {
87
87
  'react/prop-types': OFF,
88
88
  };
89
89
 
90
+ /** @type {import('eslint').Linter.Config} */
90
91
  const baseConfig = {
91
92
  parser: '@babel/eslint-parser',
92
93
  parserOptions: {
@@ -106,8 +107,15 @@ const baseConfig = {
106
107
  version: 'detect',
107
108
  },
108
109
  },
109
- plugins: ['react', 'react-hooks'],
110
- extends: ['plugin:react/recommended', 'prettier'],
110
+ plugins: ['react', 'react-hooks', 'import'],
111
+ extends: [
112
+ 'plugin:react/recommended',
113
+ // this config enables eslint-plugin-import to resolve JavaScript and TypeScript files
114
+ // https://github.com/import-js/eslint-plugin-import/blob/v2.26.0/config/typescript.js
115
+ // Some rules provided by eslint-plugin-import e.g. `import/no-duplicates` don't work without it
116
+ 'plugin:import/typescript',
117
+ 'prettier',
118
+ ],
111
119
  rules: {
112
120
  ...baseRules,
113
121
  ...reactRules,
@@ -126,6 +134,13 @@ const baseConfig = {
126
134
  'plugin:@typescript-eslint/recommended',
127
135
  'prettier',
128
136
  ],
137
+ settings: {
138
+ // adds comprehensive TypeScript support to eslint-plugin-import
139
+ // https://github.com/import-js/eslint-import-resolver-typescript
140
+ 'import/resolver': {
141
+ typescript: {},
142
+ },
143
+ },
129
144
  rules: {
130
145
  '@typescript-eslint/no-unused-expressions': ERROR,
131
146
  '@typescript-eslint/no-unused-vars': [
@@ -159,11 +174,7 @@ const baseConfig = {
159
174
  env: {
160
175
  es6: true,
161
176
  },
162
- extends: [
163
- 'plugin:import/errors',
164
- 'plugin:import/warnings',
165
- 'plugin:import/typescript',
166
- ],
177
+ extends: ['plugin:import/errors', 'plugin:import/warnings'],
167
178
  settings: {
168
179
  'import/resolver': {
169
180
  node: {
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "eslint-config-seek",
3
- "version": "10.0.0",
3
+ "version": "10.1.0",
4
4
  "description": "ESLint configuration used by SEEK",
5
5
  "main": ".eslintrc.js",
6
+ "files": [
7
+ ".eslintrc.js"
8
+ ],
6
9
  "repository": {
7
10
  "type": "git",
8
11
  "url": "https://github.com/seek-oss/eslint-config-seek.git"
@@ -12,36 +15,40 @@
12
15
  "bugs": {
13
16
  "url": "https://github.com/seek-oss/eslint-config-seek/issues"
14
17
  },
15
- "scripts": {
16
- "release": "changeset publish",
17
- "test": "eslint .",
18
- "changeset-version": "changeset version && prettier --write ."
19
- },
20
18
  "homepage": "https://github.com/seek-oss/eslint-config-seek#readme",
21
19
  "dependencies": {
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",
20
+ "@babel/core": "^7.19.6",
21
+ "@babel/eslint-parser": "^7.19.1",
22
+ "@babel/preset-react": "^7.18.6",
23
+ "@typescript-eslint/eslint-plugin": "^5.41.0",
24
+ "@typescript-eslint/parser": "^5.41.0",
27
25
  "eslint-config-prettier": "^8.5.0",
28
- "eslint-import-resolver-node": "^0.3.6",
26
+ "eslint-import-resolver-typescript": "3.5.2",
29
27
  "eslint-plugin-cypress": "^2.12.1",
30
- "eslint-plugin-import": "^2.25.4",
31
- "eslint-plugin-jest": "^27.0.1",
32
- "eslint-plugin-react": "^7.29.4",
33
- "eslint-plugin-react-hooks": "^4.3.0",
28
+ "eslint-plugin-import": "^2.26.0",
29
+ "eslint-plugin-jest": "^27.1.3",
30
+ "eslint-plugin-react": "^7.31.10",
31
+ "eslint-plugin-react-hooks": "^4.6.0",
34
32
  "find-root": "^1.1.0"
35
33
  },
36
34
  "devDependencies": {
37
- "@changesets/cli": "2.17.0",
38
- "@changesets/get-github-info": "0.5.0",
39
- "eslint": "8.11.0",
40
- "prettier": "2.4.1",
41
- "typescript": "^4.1.2"
35
+ "@changesets/cli": "2.25.0",
36
+ "@changesets/get-github-info": "0.5.1",
37
+ "eslint": "8.26.0",
38
+ "prettier": "2.7.1",
39
+ "typescript": "^4.8.4"
42
40
  },
43
41
  "peerDependencies": {
44
42
  "eslint": ">=6",
45
43
  "typescript": ">=3.3"
44
+ },
45
+ "packageManager": "pnpm@7.14.0",
46
+ "volta": {
47
+ "node": "16.18.0"
48
+ },
49
+ "scripts": {
50
+ "release": "changeset publish",
51
+ "test": "eslint .",
52
+ "changeset-version": "changeset version && prettier --write ."
46
53
  }
47
- }
54
+ }
@@ -1,8 +0,0 @@
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)
@@ -1,162 +0,0 @@
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
- }
@@ -1,10 +0,0 @@
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/.editorconfig DELETED
@@ -1,13 +0,0 @@
1
- # editorconfig.org
2
- root = true
3
-
4
- [*]
5
- indent_style = space
6
- indent_size = 2
7
- end_of_line = lf
8
- charset = utf-8
9
- trim_trailing_whitespace = true
10
- insert_final_newline = true
11
-
12
- [*.md]
13
- trim_trailing_whitespace = false
@@ -1,38 +0,0 @@
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 }}
@@ -1,26 +0,0 @@
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 DELETED
@@ -1,68 +0,0 @@
1
- # eslint-config-seek
2
-
3
- ## 10.0.0
4
-
5
- ### Major Changes
6
-
7
- - eslint-plugin-jest 27 ([#79](https://github.com/seek-oss/eslint-config-seek/pull/79))
8
-
9
- This major release includes breaking changes. See the [release note](https://github.com/jest-community/eslint-plugin-jest/releases/tag/v27.0.0) for more information.
10
-
11
- The `jest/no-alias-methods` rule is now [enforced](https://github.com/jest-community/eslint-plugin-jest/pull/1221) to discourage usage of alias methods that will be [removed in Jest 30](https://github.com/facebook/jest/issues/13164).
12
-
13
- ```diff
14
- - .toBeCalled()
15
- + .toHaveBeenCalled()
16
- ```
17
-
18
- ## 9.0.0
19
-
20
- ### Major Changes
21
-
22
- - Support ESLint 8.x ([#73](https://github.com/seek-oss/eslint-config-seek/pull/73))
23
-
24
- 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:
25
-
26
- - [TypeScript ESLint v5](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v5.0.0)
27
-
28
- This includes changes to the recommended rule set.
29
-
30
- - [`babel-eslint`](https://www.npmjs.com/package/babel-eslint) → [`@babel/eslint-parser`](https://www.npmjs.com/package/@babel/eslint-parser)
31
-
32
- This resolves the following installation warning:
33
-
34
- ```console
35
- babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
36
- ```
37
-
38
- - [`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)
39
-
40
- This unifies on a single `prettier` config.
41
-
42
- [`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.
43
-
44
- ### Minor Changes
45
-
46
- - Turn off [`no-return-await`](https://eslint.org/docs/rules/no-return-await) ([#74](https://github.com/seek-oss/eslint-config-seek/pull/74))
47
-
48
- `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.
49
-
50
- ## 8.0.0
51
-
52
- ### Major Changes
53
-
54
- - Remove support for Flow ([#64](https://github.com/seek-oss/eslint-config-seek/pull/64))
55
-
56
- 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).
57
-
58
- Affected projects should migrate to TypeScript.
59
-
60
- - Remove support for CSS Modules ([#64](https://github.com/seek-oss/eslint-config-seek/pull/64))
61
-
62
- [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/).
63
-
64
- Affected projects should migrate to vanilla-extract.
65
-
66
- ### Patch Changes
67
-
68
- - Detect the react version ([#68](https://github.com/seek-oss/eslint-config-seek/pull/68))
@@ -1,5 +0,0 @@
1
- module.exports = {
2
- singleQuote: true,
3
- tabWidth: 2,
4
- trailingComma: 'all',
5
- };