Skip to content

Commit

Permalink
feat!: cleanup deps, remove unnecessary ponyfills (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin authored Mar 12, 2024
1 parent b79f030 commit 46ee54d
Show file tree
Hide file tree
Showing 30 changed files with 1,368 additions and 696 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
15 changes: 15 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://unpkg.com/@changesets/config/schema.json",
"changelog": [
"@changesets/changelog-github",
{
"repo": "un-es/eslint-plugin-import-x"
}
],
"commit": false,
"fixed": [],
"access": "public",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": []
}
5 changes: 5 additions & 0 deletions .changeset/ninety-files-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'eslint-plugin-import-x': minor
---

feat!: cleanup deps, remove unnecessary ponyfills
4 changes: 4 additions & 0 deletions .codesandbox/ci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"node": "18",
"sandboxes": []
}
11 changes: 11 additions & 0 deletions .eslint-doc-generatorrc.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import prettier from 'prettier'

import prettierRC from './.prettierrc.mjs'

/** @type {import('eslint-doc-generator').GenerateOptions} */
const config = {
postprocess: (content, path) =>
prettier.format(content, { ...prettierRC, parser: 'markdown' }),
}

export default config
52 changes: 52 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CI

on:
- push
- pull_request

jobs:
ci:
name: Lint and Test with Node.js ${{ matrix.node }} on ${{ matrix.os }}
strategy:
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
node:
- 18
- 20
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Enable Corepack
run: corepack enable

- name: Setup Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: yarn
env:
# https://github.com/actions/setup-node/issues/531#issuecomment-1819151412
SKIP_YARN_COREPACK_CHECK: 1

- name: Install Dependencies
run: yarn --immutable
env:
SKIP_YARN_COREPACK_CHECK: 1

- name: Build, Lint and Test
run: |
yarn build
yarn lint
yarn test
env:
EFF_NO_LINK_RULES: true
PARSER_NO_WATCH: true
SKIP_YARN_COREPACK_CHECK: 1

- name: Codecov
uses: codecov/codecov-action@v3
40 changes: 40 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CodeQL

on:
push:
pull_request:
schedule:
- cron: '41 19 * * 6'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language:
- javascript

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
queries: +security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: '/language:${{ matrix.language }}'
32 changes: 32 additions & 0 deletions .github/workflows/pkg-size.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Package Size Report

on:
pull_request_target:
branches:
- master

jobs:
pkg-size-report:
name: Package Size Report
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Enable Corepack
run: corepack enable

- name: Setup Node.js LTS
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: yarn
env:
# https://github.com/actions/setup-node/issues/531#issuecomment-1819151412
SKIP_YARN_COREPACK_CHECK: 1

- name: Package Size Report
uses: pkg-size/action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53 changes: 53 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Release

on:
push:
branches:
- master

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Enable Corepack
run: corepack enable

- name: Setup Node.js LTS
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: yarn
env:
# https://github.com/actions/setup-node/issues/531#issuecomment-1819151412
SKIP_YARN_COREPACK_CHECK: 1

- name: Install Dependencies
run: yarn --immutable
env:
SKIP_YARN_COREPACK_CHECK: 1

# required for linting before commit
- name: Build
run: yarn build
env:
SKIP_YARN_COREPACK_CHECK: 1

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
commit: 'chore: release package(s)'
title: 'chore: release package(s)'
version: yarn run version
publish: yarn release:only
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
SKIP_YARN_COREPACK_CHECK: 1
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test/fixtures/just-json-files/invalid.json
test/fixtures/malformed.js
test/fixtures/with-syntax-error/package.json
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = {
'@babel/env',
{
targets: {
node: 4,
node: 12,
},
},
],
Expand Down
6 changes: 0 additions & 6 deletions docs/rules/no-restricted-paths.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ The following patterns are not considered problems when configuration set to `{
import baz from '../client/baz'
```

---

Given the following folder structure:

```pt
Expand Down Expand Up @@ -99,8 +97,6 @@ The following pattern is not considered a problem:
import b from './b'
```

---

Given the following folder structure:

```pt
Expand Down Expand Up @@ -138,8 +134,6 @@ The following import is not considered a problem in `my-project/client/sub-modul
import b from './baz'
```

---

Given the following folder structure:

```pt
Expand Down
27 changes: 8 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"license": "MIT",
"packageManager": "yarn@1.22.19",
"engines": {
"node": ">=4"
"node": ">=12"
},
"main": "lib/index.js",
"exports": {
Expand Down Expand Up @@ -35,33 +35,23 @@
],
"scripts": {
"build": "babel --quiet --out-dir lib src",
"lint": "yarn lint:es && yarn update:eslint-docs --check && yarn lint:md",
"lint": "yarn lint:es && yarn update:eslint-docs --check",
"lint:es": "eslint . --cache",
"lint:md": "markdownlint \"**/*.md\"",
"prebuild": "rimraf lib",
"prepublishOnly": "yarn build",
"test": "jest",
"update:eslint-docs": "yarn build && eslint-doc-generator --rule-doc-title-format prefix-name --rule-doc-section-options false --rule-list-split meta.docs.category --ignore-config stage-0 --config-emoji recommended,☑️",
"watch": "yarn test --watch"
},
"peerDependencies": {
"eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8"
"eslint": "^7.2.0 || ^8"
},
"dependencies": {
"array-includes": "^3.1.7",
"array.prototype.findlastindex": "^1.2.4",
"array.prototype.flat": "^1.3.2",
"array.prototype.flatmap": "^1.3.2",
"debug": "^3.2.7",
"doctrine": "^2.1.0",
"eslint-import-resolver-node": "^0.3.9",
"hasown": "^2.0.1",
"is-core-module": "^2.13.1",
"is-glob": "^4.0.3",
"minimatch": "^3.1.2",
"object.fromentries": "^2.0.7",
"object.groupby": "^1.0.2",
"object.values": "^1.1.7",
"semver": "^6.3.1",
"tsconfig-paths": "^3.15.0"
},
Expand All @@ -77,17 +67,18 @@
"@babel/preset-flow": "^7.24.0",
"@babel/preset-react": "^7.23.3",
"@babel/register": "^7.23.7",
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.1",
"@eslint/import-test-order-redirect-scoped": "link:./test/fixtures/order-redirect-scoped",
"@test-scope/some-module": "link:./test/fixtures/symlinked-module",
"@types/jest": "^29.5.12",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^2.23.0 || ^3.3.0 || ^4.29.3 || ^5.10.0",
"chai": "^4.3.10",
"cross-env": "^4.0.0",
"escope": "^3.6.0",
"eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8",
"eslint-config-prettier": "^9.1.0",
"eslint-doc-generator": "^1.6.1",
"eslint-doc-generator": "^1.7.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-import-resolver-webpack": "^0.13.8",
"eslint-import-test-order-redirect": "link:./test/fixtures/order-redirect",
Expand All @@ -98,15 +89,13 @@
"eslint-plugin-prettier": "^5.1.3",
"glob": "^7.2.3",
"jest": "^29.7.0",
"jsonc-parser": "=3.2.0",
"jsonc-parser": "^3.2.1",
"lodash.isarray": "^4.0.0",
"markdownlint-cli": "~0.35",
"npm-which": "^3.0.1",
"prettier": "^3.2.5",
"redux": "^3.7.2",
"rimraf": "^2.7.1",
"sinon": "^2.4.1",
"svelte": "^4.2.12",
"typescript": "^2.8.1 || ~3.9.5 || ~4.5.2"
"typescript": "^5.4.2"
}
}
6 changes: 2 additions & 4 deletions src/ExportMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ import * as unambiguous from './utils/unambiguous'

import { tsConfigLoader } from 'tsconfig-paths/lib/tsconfig-loader'

import includes from 'array-includes'

let ts

const log = debug('eslint-plugin-import-x:ExportMap')
Expand Down Expand Up @@ -776,7 +774,7 @@ ExportMap.parse = function (path, content, context) {
}

// This doesn't declare anything, but changes what's being exported.
if (includes(exports, n.type)) {
if (exports.includes(n.type)) {
const exportedName =
n.type === 'TSNamespaceExportDeclaration'
? (n.id || n.name).name
Expand All @@ -795,7 +793,7 @@ ExportMap.parse = function (path, content, context) {
]
const exportedDecls = ast.body.filter(
({ type, id, declarations }) =>
includes(declTypes, type) &&
declTypes.includes(type) &&
((id && id.name === exportedName) ||
(declarations &&
declarations.find(d => d.id.name === exportedName))),
Expand Down
2 changes: 1 addition & 1 deletion src/core/importType.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {
relative,
resolve as nodeResolve,
} from 'path'
import isCoreModule from 'is-core-module'

import { isCoreModule } from '../utils/is-core-module'
import resolve from '../utils/resolve'
import { getContextPackagePath } from './packagePath'

Expand Down
Loading

0 comments on commit 46ee54d

Please sign in to comment.