Skip to content

Commit 6cba8eb

Browse files
authored
feat: migrate to ESM primary (#271)
1 parent a2abfb6 commit 6cba8eb

File tree

170 files changed

+2990
-1451
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

170 files changed

+2990
-1451
lines changed

.changeset/thin-beans-speak.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"eslint-plugin-import-x": minor
3+
---
4+
5+
feat: migrate to ESM primary

.env.yarn

Lines changed: 0 additions & 2 deletions
This file was deleted.

.eslint-doc-generatorrc.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { format } from 'prettier'
2+
3+
import prettierRC from './.prettierrc.js'
4+
5+
/** @type {import('eslint-doc-generator').GenerateOptions} */
6+
const config = {
7+
postprocess: content =>
8+
format(content, { ...prettierRC, parser: 'markdown' }),
9+
}
10+
11+
export default config

.eslint-doc-generatorrc.mjs

Lines changed: 0 additions & 11 deletions
This file was deleted.

.eslintignore

Lines changed: 0 additions & 13 deletions
This file was deleted.

.eslintrc.js renamed to .eslintrc.cjs

Lines changed: 42 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
// ! This file is here for testing `no-unused-modules` rule for eslintrc
2+
13
const { version } = require('eslint/package.json')
24

3-
const nonLatestEslint = +version.split('.')[0] < 9
5+
const noEslintrc = +version.split('.')[0] > 8
6+
7+
const testCompiled = process.env.TEST_COMPILED === '1'
48

59
/**
610
* @type {import('eslint').Linter.Config}
@@ -12,15 +16,15 @@ module.exports = {
1216
'eslint:recommended',
1317
'plugin:@typescript-eslint/recommended',
1418
'plugin:eslint-plugin/recommended',
15-
'plugin:import-x/recommended',
19+
testCompiled && 'plugin:import-x/recommended',
1620
'plugin:json/recommended-legacy',
1721
'plugin:mdx/recommended',
1822
'plugin:n/recommended',
19-
'plugin:unicorn/recommended',
23+
!noEslintrc && 'plugin:unicorn/recommended',
2024
'plugin:yml/standard',
2125
'plugin:yml/prettier',
2226
'plugin:prettier/recommended',
23-
],
27+
].filter(Boolean),
2428
env: {
2529
node: true,
2630
es6: true,
@@ -34,7 +38,7 @@ module.exports = {
3438
'@typescript-eslint/no-non-null-assertion': 'off',
3539
'@typescript-eslint/no-require-imports': 'off',
3640

37-
'no-constant-condition': nonLatestEslint ? 'off' : 'error',
41+
'no-constant-condition': noEslintrc ? 'error' : 'off',
3842

3943
'eslint-plugin/consistent-output': ['error', 'always'],
4044
'eslint-plugin/meta-property-ordering': 'error',
@@ -52,31 +56,36 @@ module.exports = {
5256
'n/no-missing-import': 'off',
5357
'n/no-missing-require': 'off',
5458
'n/no-unsupported-features/es-syntax': 'off',
55-
'unicorn/filename-case': [
56-
'error',
57-
{
58-
case: 'kebabCase',
59-
ignore: [String.raw`^(CONTRIBUTING|README)\.md$`],
60-
},
61-
],
59+
...(noEslintrc || {
60+
'unicorn/filename-case': [
61+
'error',
62+
{
63+
case: 'kebabCase',
64+
ignore: [String.raw`^(CONTRIBUTING|README)\.md$`],
65+
},
66+
],
67+
}),
6268
'unicorn/no-array-callback-reference': 'off',
6369
'unicorn/no-array-reduce': 'off',
6470
'unicorn/no-null': 'off',
6571
'unicorn/prefer-module': 'off',
6672
'unicorn/prevent-abbreviations': 'off',
6773
'unicorn/prefer-at': 'off',
74+
'unicorn/prefer-export-from': ['error', { ignoreUsedVariables: true }],
6875

6976
// dog fooding
70-
'import-x/no-extraneous-dependencies': [
71-
'error',
72-
{
73-
devDependencies: ['test/**'],
74-
optionalDependencies: false,
75-
peerDependencies: true,
76-
bundledDependencies: false,
77-
},
78-
],
79-
'import-x/unambiguous': 'off',
77+
...(testCompiled && {
78+
'import-x/no-extraneous-dependencies': [
79+
'error',
80+
{
81+
devDependencies: ['test/**'],
82+
optionalDependencies: false,
83+
peerDependencies: true,
84+
bundledDependencies: false,
85+
},
86+
],
87+
'import-x/unambiguous': 'off',
88+
}),
8089
},
8190

8291
overrides: [
@@ -104,16 +113,18 @@ module.exports = {
104113
varsIgnorePattern: '^_',
105114
},
106115
],
107-
'import-x/consistent-type-specifier-style': 'error',
108-
'import-x/order': [
109-
'error',
110-
{
111-
alphabetize: {
112-
order: 'asc',
116+
...(testCompiled && {
117+
'import-x/consistent-type-specifier-style': 'error',
118+
'import-x/order': [
119+
'error',
120+
{
121+
alphabetize: {
122+
order: 'asc',
123+
},
124+
'newlines-between': 'always',
113125
},
114-
'newlines-between': 'always',
115-
},
116-
],
126+
],
127+
}),
117128
},
118129
settings: {
119130
'import-x/resolver': {

.github/workflows/ci.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ jobs:
2222
- 20
2323
- 22
2424
eslint:
25-
- '8.56'
26-
- '8'
27-
- '9'
25+
- 8.56
26+
- 8
27+
- 9
2828

2929
include:
3030
- executeLint: true
@@ -44,22 +44,20 @@ jobs:
4444
cache: yarn
4545

4646
- name: Install ESLint ${{ matrix.eslint }}
47+
if: ${{ matrix.eslint != 9 }}
4748
run: |
48-
yarn add -D eslint@${{ matrix.eslint }}
49+
yarn add -D eslint@${{ matrix.eslint }} eslint-plugin-unicorn@56
4950
5051
- name: Install Dependencies
5152
run: yarn --immutable
5253

5354
- name: Build and Test
54-
run: |
55-
yarn test-compiled
56-
yarn test
55+
run: yarn run-s test-compiled test
5756

5857
- name: Lint
5958
run: yarn lint
6059
if: ${{ matrix.executeLint }}
6160
env:
62-
EFF_NO_LINK_RULES: true
6361
PARSER_NO_WATCH: true
6462

6563
- name: Codecov

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: CodeQL
22

33
on:
4-
push:
5-
pull_request:
4+
push: null
5+
pull_request: null
66
schedule:
77
- cron: '41 19 * * 6'
88

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)