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

feat: integrate import-isolation into presets #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 10 additions & 0 deletions packages/eslint-config-testing/.eslint-config-common.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ const { defineConfig } = require('eslint-define-config');

module.exports = defineConfig({
rules: {
'import-isolation/isolation': [
'error',
{
isolationGroups: [
{
directories: ['isolation/*'],
},
],
},
],
'eslint-comments/no-unlimited-disable': 'error',
'eslint-comments/require-description': 'error',
},
Expand Down
3 changes: 2 additions & 1 deletion packages/eslint-config-testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
},
"keywords": [],
"devDependencies": {
"@kwai-explore/eslint-config": "workspace:*",
"@kwai-explore/eslint-config": "0.5.1",
"@kwai-explore/tsconfig": "workspace:*",
"@types/node": "^20.4.2",
"eslint": "^8.45.0",
"eslint-plugin-import-isolation": "workspace:^",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本来预期 pnpm 会 hoist eslint-config 的这个依赖,但是没生效,先手动安装一下

"ts-node": "^10.9.1",
"typescript": "^5.1.6"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<script lang="ts" setup>
import TheB from '../b/TheB.vue';
</script>

<template>
<TheB />
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<div>Hi</div>
</template>
3 changes: 2 additions & 1 deletion packages/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kwai-explore/eslint-config",
"version": "0.4.1",
"version": "0.5.1",
"main": "index.js",
"license": "MIT",
"author": {
Expand Down Expand Up @@ -36,6 +36,7 @@
"eslint-import-resolver-typescript": "^3.5.5",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "npm:eslint-plugin-i@^2.27.5-4",
"eslint-plugin-import-isolation": "workspace:^",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-sonar": "^0.12.0",
"eslint-plugin-sonarjs": "^0.19.0",
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-config/preset/react-ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
const { defineConfig } = require('eslint-define-config');

module.exports = defineConfig({
plugins: ['import-isolation'],
overrides: [
{
files: ['**/*.ts', '**/*.tsx', '**/*.mts'],
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-config/preset/vue2-ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
const { defineConfig } = require('eslint-define-config');

module.exports = defineConfig({
plugins: ['import-isolation'],
overrides: [
{
files: ['**/*.ts', '**/*.mts', '**/*.vue'],
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-config/preset/vue3-ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
const { defineConfig } = require('eslint-define-config');

module.exports = defineConfig({
plugins: ['import-isolation'],
overrides: [
{
files: ['**/*.ts', '**/*.mts', '**/*.vue'],
Expand Down
18 changes: 14 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.