From 95a4337530bac11758bc8fddd58484cc26b6073b Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Sun, 13 Nov 2022 21:22:12 -0600 Subject: [PATCH] style: Add simple-import-sort and run --- .eslintrc.json | 6 ++++-- package-lock.json | 17 +++++++++++++++++ package.json | 8 +++----- src/functions.ts | 4 ++-- src/main.ts | 3 ++- test/functions.ts | 5 +++-- test/releasedata.ts | 5 +++-- 7 files changed, 34 insertions(+), 14 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index d64324a..d3a43ff 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,5 +1,5 @@ { - "plugins": ["ava", "@typescript-eslint"], + "plugins": ["ava", "@typescript-eslint", "simple-import-sort"], "extends": ["plugin:github/recommended", "plugin:ava/recommended"], "parser": "@typescript-eslint/parser", "parserOptions": { @@ -8,6 +8,8 @@ "project": "./tsconfig.json" }, "rules": { + "simple-import-sort/imports": "error", + "simple-import-sort/exports": "error", "i18n-text/no-en": "off", "eslint-comments/no-use": "off", "import/no-namespace": "off", @@ -49,7 +51,7 @@ "@typescript-eslint/require-array-sort-compare": "error", "@typescript-eslint/restrict-plus-operands": "error", "semi": "off", - "sort-imports": "warn", + "sort-imports": "off", "@typescript-eslint/semi": ["error", "never"], "@typescript-eslint/type-annotation-spacing": "error", "@typescript-eslint/unbound-method": "error" diff --git a/package-lock.json b/package-lock.json index 3fe09df..68559a1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,6 +31,7 @@ "eslint-plugin-ava": "^13.2.0", "eslint-plugin-github": "^4.4.1", "eslint-plugin-jest": "^27.1.5", + "eslint-plugin-simple-import-sort": "^8.0.0", "prettier": "^2.7.1", "ts-node": "^10.9.1", "typescript": "^4.7.3" @@ -2135,6 +2136,15 @@ } } }, + "node_modules/eslint-plugin-simple-import-sort": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-8.0.0.tgz", + "integrity": "sha512-bXgJQ+lqhtQBCuWY/FUWdB27j4+lqcvXv5rUARkzbeWLwea+S5eBZEQrhnO+WgX3ZoJHVj0cn943iyXwByHHQw==", + "dev": true, + "peerDependencies": { + "eslint": ">=5.0.0" + } + }, "node_modules/eslint-rule-documentation": { "version": "1.0.23", "resolved": "https://registry.npmjs.org/eslint-rule-documentation/-/eslint-rule-documentation-1.0.23.tgz", @@ -6487,6 +6497,13 @@ "prettier-linter-helpers": "^1.0.0" } }, + "eslint-plugin-simple-import-sort": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-8.0.0.tgz", + "integrity": "sha512-bXgJQ+lqhtQBCuWY/FUWdB27j4+lqcvXv5rUARkzbeWLwea+S5eBZEQrhnO+WgX3ZoJHVj0cn943iyXwByHHQw==", + "dev": true, + "requires": {} + }, "eslint-rule-documentation": { "version": "1.0.23", "resolved": "https://registry.npmjs.org/eslint-rule-documentation/-/eslint-rule-documentation-1.0.23.tgz", diff --git a/package.json b/package.json index 0492511..466e473 100644 --- a/package.json +++ b/package.json @@ -34,15 +34,12 @@ "ts-node/register/transpile-only" ], "files": [ - "test/**/*.ts" + "test/**/*.ts", + "!test/utils.ts" ], "source": [ "src/**/*.ts" ], - "files": [ - "test/**/*.ts", - "!test/utils.ts" - ], "concurrency": 1, "serial": true, "powerAssert": true @@ -71,6 +68,7 @@ "eslint-plugin-ava": "^13.2.0", "eslint-plugin-github": "^4.4.1", "eslint-plugin-jest": "^27.1.5", + "eslint-plugin-simple-import-sort": "^8.0.0", "prettier": "^2.7.1", "ts-node": "^10.9.1", "typescript": "^4.7.3" diff --git a/src/functions.ts b/src/functions.ts index f26b322..ebc49a2 100644 --- a/src/functions.ts +++ b/src/functions.ts @@ -1,8 +1,8 @@ import * as core from '@actions/core' -import * as fs from 'fs' -import * as tc from '@actions/tool-cache' import { GitHub } from '@actions/github/lib/utils' +import * as tc from '@actions/tool-cache' import retry from 'async-retry' +import * as fs from 'fs' import semver from 'semver' const NEXTFLOW_REPO = { owner: 'nextflow-io', repo: 'nextflow' } diff --git a/src/main.ts b/src/main.ts index f143529..0c1d315 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,9 +1,10 @@ import * as core from '@actions/core' import * as exec from '@actions/exec' -import * as fs from 'fs' import * as github from '@actions/github' import { GitHub } from '@actions/github/lib/utils' import * as tc from '@actions/tool-cache' +import * as fs from 'fs' + import { install_nextflow, nextflow_bin_url, release_data } from './functions' async function run(): Promise { diff --git a/test/functions.ts b/test/functions.ts index 59fe481..8ec473d 100644 --- a/test/functions.ts +++ b/test/functions.ts @@ -1,9 +1,10 @@ -import * as functions from '../src/functions' -import { getToken } from './utils' import * as github from '@actions/github' import { GitHub } from '@actions/github/lib/utils' import anyTest, { TestFn } from 'ava' // eslint-disable-line import/no-unresolved +import * as functions from '../src/functions' +import { getToken } from './utils' + const test = anyTest as TestFn<{ token: string octokit: InstanceType diff --git a/test/releasedata.ts b/test/releasedata.ts index 8dbd523..3a1b815 100644 --- a/test/releasedata.ts +++ b/test/releasedata.ts @@ -1,9 +1,10 @@ import * as github from '@actions/github' -import { release_data } from '../src/functions' -import { getToken } from './utils' import { GitHub } from '@actions/github/lib/utils' import anyTest, { TestFn } from 'ava' // eslint-disable-line import/no-unresolved +import { release_data } from '../src/functions' +import { getToken } from './utils' + const test = anyTest as TestFn<{ token: string octokit: InstanceType