Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore!: bump node requirement, enable more lint rules #54

Merged
merged 4 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"changelog": [
"@changesets/changelog-github",
{
"repo": "un-es/eslint-plugin-import-x"
"repo": "un-ts/eslint-plugin-import-x"
}
],
"commit": false,
Expand Down
21 changes: 20 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
/**
* @type {import('eslint').Linter.Config}
*/
// eslint-disable-next-line unicorn/prefer-module
module.exports = {
root: true,
plugins: ['eslint-plugin', 'import-x'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:eslint-plugin/recommended',
'plugin:import-x/recommended',
'plugin:n/recommended',
'plugin:unicorn/recommended',
'plugin:prettier/recommended',
],
env: {
Expand Down Expand Up @@ -36,6 +38,16 @@ module.exports = {
],
'eslint-plugin/require-meta-schema': 'error',
'eslint-plugin/require-meta-type': 'error',
'n/no-extraneous-require': 'off',
'n/no-missing-import': 'off',
'n/no-missing-require': 'off',
'n/no-unsupported-features/es-syntax': 'off',
'unicorn/no-array-callback-reference': 'off',
'unicorn/no-array-reduce': 'off',
'unicorn/no-null': 'off',
'unicorn/prefer-module': 'off',
'unicorn/prevent-abbreviations': 'off',
'unicorn/prefer-at': 'off',

// dog fooding
'import-x/no-extraneous-dependencies': [
Expand Down Expand Up @@ -68,6 +80,13 @@ module.exports = {
fixStyle: 'inline-type-imports',
},
],
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'import-x/consistent-type-specifier-style': 'error',
'import-x/order': [
'error',
Expand Down
22 changes: 11 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,44 @@

### Patch Changes

- [#51](https://github.com/un-es/eslint-plugin-import-x/pull/51) [`f4ca4b5`](https://github.com/un-es/eslint-plugin-import-x/commit/f4ca4b503389ef6aa35bee50452042eee13cf66f) Thanks [@JounQin](https://github.com/JounQin)! - refactor: migrate all remaining rules
- [#51](https://github.com/un-ts/eslint-plugin-import-x/pull/51) [`f4ca4b5`](https://github.com/un-ts/eslint-plugin-import-x/commit/f4ca4b503389ef6aa35bee50452042eee13cf66f) Thanks [@JounQin](https://github.com/JounQin)! - refactor: migrate all remaining rules

- [#48](https://github.com/un-es/eslint-plugin-import-x/pull/48) [`3d7a551`](https://github.com/un-es/eslint-plugin-import-x/commit/3d7a551de617188079bf99c9478158adace02fac) Thanks [@JounQin](https://github.com/JounQin)! - refactor: migrate more rules
- [#48](https://github.com/un-ts/eslint-plugin-import-x/pull/48) [`3d7a551`](https://github.com/un-ts/eslint-plugin-import-x/commit/3d7a551de617188079bf99c9478158adace02fac) Thanks [@JounQin](https://github.com/JounQin)! - refactor: migrate more rules

- [#50](https://github.com/un-es/eslint-plugin-import-x/pull/50) [`de896f4`](https://github.com/un-es/eslint-plugin-import-x/commit/de896f46b1e3d3bcc51015d2e0269e6ae80dc87d) Thanks [@JounQin](https://github.com/JounQin)! - refactor: migrate several rules
- [#50](https://github.com/un-ts/eslint-plugin-import-x/pull/50) [`de896f4`](https://github.com/un-ts/eslint-plugin-import-x/commit/de896f46b1e3d3bcc51015d2e0269e6ae80dc87d) Thanks [@JounQin](https://github.com/JounQin)! - refactor: migrate several rules

## 0.3.0

### Minor Changes

- [#42](https://github.com/un-es/eslint-plugin-import-x/pull/42) [`6ee88e8`](https://github.com/un-es/eslint-plugin-import-x/commit/6ee88e8b648e6d5b434a5d56d8c04ad41aa3d491) Thanks [@JounQin](https://github.com/JounQin)! - feat!: start TypeScript migration
- [#42](https://github.com/un-ts/eslint-plugin-import-x/pull/42) [`6ee88e8`](https://github.com/un-ts/eslint-plugin-import-x/commit/6ee88e8b648e6d5b434a5d56d8c04ad41aa3d491) Thanks [@JounQin](https://github.com/JounQin)! - feat!: start TypeScript migration

### Patch Changes

- [#44](https://github.com/un-es/eslint-plugin-import-x/pull/44) [`bbf46c3`](https://github.com/un-es/eslint-plugin-import-x/commit/bbf46c302f4f2632e1d4b76c52101c8ed8c469c2) Thanks [@JounQin](https://github.com/JounQin)! - feat: migrate named rule and related usage
- [#44](https://github.com/un-ts/eslint-plugin-import-x/pull/44) [`bbf46c3`](https://github.com/un-ts/eslint-plugin-import-x/commit/bbf46c302f4f2632e1d4b76c52101c8ed8c469c2) Thanks [@JounQin](https://github.com/JounQin)! - feat: migrate named rule and related usage

- [#45](https://github.com/un-es/eslint-plugin-import-x/pull/45) [`dc3d48b`](https://github.com/un-es/eslint-plugin-import-x/commit/dc3d48bb1893d5094c68ed4189029fabe8fe8ef3) Thanks [@JounQin](https://github.com/JounQin)! - refactor: migrate core utils
- [#45](https://github.com/un-ts/eslint-plugin-import-x/pull/45) [`dc3d48b`](https://github.com/un-ts/eslint-plugin-import-x/commit/dc3d48bb1893d5094c68ed4189029fabe8fe8ef3) Thanks [@JounQin](https://github.com/JounQin)! - refactor: migrate core utils

## 0.2.0

### Minor Changes

- [#38](https://github.com/un-es/eslint-plugin-import-x/pull/38) [`3a5dab4`](https://github.com/un-es/eslint-plugin-import-x/commit/3a5dab4b8f79e013016ab51d13b1f220d47fc06b) Thanks [@JounQin](https://github.com/JounQin)! - chore!: bump all upgradable (dev)Dependencies
- [#38](https://github.com/un-ts/eslint-plugin-import-x/pull/38) [`3a5dab4`](https://github.com/un-ts/eslint-plugin-import-x/commit/3a5dab4b8f79e013016ab51d13b1f220d47fc06b) Thanks [@JounQin](https://github.com/JounQin)! - chore!: bump all upgradable (dev)Dependencies

- [#36](https://github.com/un-es/eslint-plugin-import-x/pull/36) [`49e3cd2`](https://github.com/un-es/eslint-plugin-import-x/commit/49e3cd2b1a1448be4db0e645493b5363f9761026) Thanks [@JounQin](https://github.com/JounQin)! - feat!: replace tsconfig-paths with get-tsconfig
- [#36](https://github.com/un-ts/eslint-plugin-import-x/pull/36) [`49e3cd2`](https://github.com/un-ts/eslint-plugin-import-x/commit/49e3cd2b1a1448be4db0e645493b5363f9761026) Thanks [@JounQin](https://github.com/JounQin)! - feat!: replace tsconfig-paths with get-tsconfig

### Patch Changes

- [#39](https://github.com/un-es/eslint-plugin-import-x/pull/39) [`d0d36de`](https://github.com/un-es/eslint-plugin-import-x/commit/d0d36de6ff4e7a118472eed41c94cef862d1f372) Thanks [@JounQin](https://github.com/JounQin)! - docs: update repository url
- [#39](https://github.com/un-ts/eslint-plugin-import-x/pull/39) [`d0d36de`](https://github.com/un-ts/eslint-plugin-import-x/commit/d0d36de6ff4e7a118472eed41c94cef862d1f372) Thanks [@JounQin](https://github.com/JounQin)! - docs: update repository url

## 0.1.1

### Patch Changes

- [#34](https://github.com/un-es/eslint-plugin-import-x/pull/34) [`a615826`](https://github.com/un-es/eslint-plugin-import-x/commit/a6158264ce3cba829fe2de51c42a5d5ea042440d) Thanks [@JounQin](https://github.com/JounQin)! - chore: cleanup npm package content
- [#34](https://github.com/un-ts/eslint-plugin-import-x/pull/34) [`a615826`](https://github.com/un-ts/eslint-plugin-import-x/commit/a6158264ce3cba829fe2de51c42a5d5ea042440d) Thanks [@JounQin](https://github.com/JounQin)! - chore: cleanup npm package content

## 0.1.0

### Minor Changes

- [#32](https://github.com/un-es/eslint-plugin-import-x/pull/32) [`46ee54d`](https://github.com/un-es/eslint-plugin-import-x/commit/46ee54d04d0eefa3ca0cb15325f547a047172daf) Thanks [@JounQin](https://github.com/JounQin)! - feat!: cleanup deps, remove unnecessary ponyfills
- [#32](https://github.com/un-ts/eslint-plugin-import-x/pull/32) [`46ee54d`](https://github.com/un-ts/eslint-plugin-import-x/commit/46ee54d04d0eefa3ca0cb15325f547a047172daf) Thanks [@JounQin](https://github.com/JounQin)! - feat!: cleanup deps, remove unnecessary ponyfills
46 changes: 23 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# eslint-plugin-import-x

[![GitHub Actions](https://github.com/un-es/eslint-plugin-import-x/workflows/CI/badge.svg)](https://github.com/un-es/eslint-plugin-import-x/actions/workflows/ci.yml)
[![Codecov](https://img.shields.io/codecov/c/github/un-es/eslint-plugin-import-x.svg)](https://codecov.io/gh/un-es/eslint-plugin-import-x)
[![GitHub Actions](https://github.com/un-ts/eslint-plugin-import-x/workflows/CI/badge.svg)](https://github.com/un-ts/eslint-plugin-import-x/actions/workflows/ci.yml)
[![Codecov](https://img.shields.io/codecov/c/github/un-ts/eslint-plugin-import-x.svg)](https://codecov.io/gh/un-ts/eslint-plugin-import-x)
[![type-coverage](https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&prefix=%E2%89%A5&suffix=%&query=$.typeCoverage.atLeast&uri=https%3A%2F%2Fraw.githubusercontent.com%2Fun-ts%2Fsynckit%2Fmain%2Fpackage.json)](https://github.com/plantain-00/type-coverage)
[![npm](https://img.shields.io/npm/v/eslint-plugin-import-x.svg)](https://www.npmjs.com/package/eslint-plugin-import-x)
[![GitHub Release](https://img.shields.io/github/release/un-es/eslint-plugin-import-x)](https://github.com/un-es/eslint-plugin-import-x/releases)
[![GitHub Release](https://img.shields.io/github/release/un-ts/eslint-plugin-import-x)](https://github.com/un-ts/eslint-plugin-import-x/releases)

[![Conventional Commits](https://img.shields.io/badge/conventional%20commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com)
Expand Down Expand Up @@ -74,26 +74,26 @@ This plugin intends to support linting of ES2015+ (ES6+) import/export syntax, a

### Style guide

| Name                            | Description | 💼 | ⚠️ | 🚫 | 🔧 | 💡 | ❌ |
| :------------------------------------------------------------------------------- | :------------------------------------------------------------------------- | :-- | :---- | :-- | :-- | :-- | :-- |
| [consistent-type-specifier-style](docs/rules/consistent-type-specifier-style.md) | Enforce or ban the use of inline type-only markers for named imports. | | | | 🔧 | | |
| [dynamic-import-chunkname](docs/rules/dynamic-import-chunkname.md) | Enforce a leading comment with the webpackChunkName for dynamic imports. | | | | | | |
| [exports-last](docs/rules/exports-last.md) | Ensure all exports appear after other statements. | | | | | | |
| [extensions](docs/rules/extensions.md) | Ensure consistent use of file extension within the import path. | | | | | | |
| [first](docs/rules/first.md) | Ensure all imports appear before other statements. | | | | 🔧 | | |
| [group-exports](docs/rules/group-exports.md) | Prefer named exports to be grouped together in a single export declaration | | | | | | |
| [imports-first](docs/rules/imports-first.md) | Replaced by `import-x/first`. | | | | 🔧 | | ❌ |
| [max-dependencies](docs/rules/max-dependencies.md) | Enforce the maximum number of dependencies a module can have. | | | | | | |
| [newline-after-import](docs/rules/newline-after-import.md) | Enforce a newline after import statements. | | | | 🔧 | | |
| [no-anonymous-default-export](docs/rules/no-anonymous-default-export.md) | Forbid anonymous values as default exports. | | | | | | |
| [no-default-export](docs/rules/no-default-export.md) | Forbid default exports. | | | | | | |
| [no-duplicates](docs/rules/no-duplicates.md) | Forbid repeated import of the same module in multiple places. | | ☑️ 🚸 | | 🔧 | | |
| [no-named-default](docs/rules/no-named-default.md) | Forbid named default exports. | | | | | | |
| [no-named-export](docs/rules/no-named-export.md) | Forbid named exports. | | | | | | |
| [no-namespace](docs/rules/no-namespace.md) | Forbid namespace (a.k.a. "wildcard" `*`) imports. | | | | 🔧 | | |
| [no-unassigned-import](docs/rules/no-unassigned-import.md) | Forbid unassigned imports | | | | | | |
| [order](docs/rules/order.md) | Enforce a convention in module import order. | | | | 🔧 | | |
| [prefer-default-export](docs/rules/prefer-default-export.md) | Prefer a default export if module exports a single name or multiple names. | | | | | | |
| Name                            | Description | 💼 | ⚠️ | 🚫 | 🔧 | 💡 | ❌ |
| :------------------------------------------------------------------------------- | :-------------------------------------------------------------------------- | :-- | :---- | :-- | :-- | :-- | :-- |
| [consistent-type-specifier-style](docs/rules/consistent-type-specifier-style.md) | Enforce or ban the use of inline type-only markers for named imports. | | | | 🔧 | | |
| [dynamic-import-chunkname](docs/rules/dynamic-import-chunkname.md) | Enforce a leading comment with the webpackChunkName for dynamic imports. | | | | | | |
| [exports-last](docs/rules/exports-last.md) | Ensure all exports appear after other statements. | | | | | | |
| [extensions](docs/rules/extensions.md) | Ensure consistent use of file extension within the import path. | | | | | | |
| [first](docs/rules/first.md) | Ensure all imports appear before other statements. | | | | 🔧 | | |
| [group-exports](docs/rules/group-exports.md) | Prefer named exports to be grouped together in a single export declaration. | | | | | | |
| [imports-first](docs/rules/imports-first.md) | Replaced by `import-x/first`. | | | | 🔧 | | ❌ |
| [max-dependencies](docs/rules/max-dependencies.md) | Enforce the maximum number of dependencies a module can have. | | | | | | |
| [newline-after-import](docs/rules/newline-after-import.md) | Enforce a newline after import statements. | | | | 🔧 | | |
| [no-anonymous-default-export](docs/rules/no-anonymous-default-export.md) | Forbid anonymous values as default exports. | | | | | | |
| [no-default-export](docs/rules/no-default-export.md) | Forbid default exports. | | | | | | |
| [no-duplicates](docs/rules/no-duplicates.md) | Forbid repeated import of the same module in multiple places. | | ☑️ 🚸 | | 🔧 | | |
| [no-named-default](docs/rules/no-named-default.md) | Forbid named default exports. | | | | | | |
| [no-named-export](docs/rules/no-named-export.md) | Forbid named exports. | | | | | | |
| [no-namespace](docs/rules/no-namespace.md) | Forbid namespace (a.k.a. "wildcard" `*`) imports. | | | | 🔧 | | |
| [no-unassigned-import](docs/rules/no-unassigned-import.md) | Forbid unassigned imports. | | | | | | |
| [order](docs/rules/order.md) | Enforce a convention in module import order. | | | | 🔧 | | |
| [prefer-default-export](docs/rules/prefer-default-export.md) | Prefer a default export if module exports a single name or multiple names. | | | | | | |

<!-- end auto-generated rules list -->

Expand Down
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"name": "eslint-plugin-import-x",
"version": "0.3.1",
"description": "Import with sanity.",
"repository": "git+https://github.com/un-es/eslint-plugin-import-x",
"repository": "git+https://github.com/un-ts/eslint-plugin-import-x",
"author": "JounQin <[email protected]> (https://www.1stG.me)",
"license": "MIT",
"packageManager": "[email protected]",
"engines": {
"node": ">=12"
"node": ">=16"
},
"main": "lib/index.js",
"exports": {
Expand Down Expand Up @@ -59,7 +59,7 @@
"devDependencies": {
"@1stg/prettier-config": "^4.0.1",
"@1stg/tsconfig": "^2.3.3",
"@angular-eslint/template-parser": "^17.2.1",
"@angular-eslint/template-parser": "^17.3.0",
"@babel/core": "^7.24.0",
"@babel/eslint-parser": "^7.23.10",
"@babel/plugin-proposal-decorators": "^7.24.0",
Expand All @@ -80,7 +80,7 @@
"@types/is-glob": "^4.0.4",
"@types/jest": "^29.5.12",
"@types/json-schema": "^7.0.15",
"@types/node": "^20.11.26",
"@types/node": "^20.11.28",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"@typescript-eslint/typescript-estree": "^5.62.0",
Expand All @@ -94,11 +94,13 @@
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-import-resolver-webpack": "^0.13.8",
"eslint-import-test-order-redirect": "link:./test/fixtures/order-redirect",
"eslint-plugin-eslint-plugin": "^2.3.0",
"eslint-plugin-eslint-plugin": "^5.4.0",
"eslint-plugin-import-x": "link:.",
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-json": "^3.1.0",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-unicorn": "^51.0.1",
"jest": "^29.7.0",
"npm-run-all2": "^6.1.2",
"prettier": "^3.2.5",
Expand Down
7 changes: 4 additions & 3 deletions src/rules/consistent-type-specifier-style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export = createRule<[Options?], MessageId>({
})
} else {
// remove specific specifiers and insert new imports for them
for (const specifier of typeSpecifiers.concat(typeofSpecifiers)) {
for (const specifier of [...typeSpecifiers, ...typeofSpecifiers]) {
context.report({
node: specifier,
messageId: 'topLevel',
Expand Down Expand Up @@ -256,10 +256,11 @@ export = createRule<[Options?], MessageId>({
)
}

return fixes.concat(
return [
...fixes,
// insert the new imports after the old declaration
fixer.insertTextAfter(node, `\n${newImports}`),
)
]
},
})
}
Expand Down
Loading
Loading