Skip to content

Commit

Permalink
Merge pull request #1699 from blackflux/dev
Browse files Browse the repository at this point in the history
[Gally]: master <- dev
  • Loading branch information
simlu authored Sep 13, 2022
2 parents dd708c3 + 7d613a2 commit 7d3bf44
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"lodash.difference": "4.5.0",
"mocha": "10.0.0",
"npm-check": "6.0.1",
"plugin-name-to-package-name": "0.1.1",
"robo-config": "4.0.5",
"smart-fs": "3.0.1"
},
Expand Down
6 changes: 2 additions & 4 deletions src/subtasks/eslint.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import fs from 'smart-fs';
import path from 'path';
import { ESLint } from 'eslint';
import { transform } from 'plugin-name-to-package-name';

export default (logger, dir, { files = [], fix = false } = {}) => (async () => {
if (files.length === 0) {
Expand All @@ -10,10 +11,7 @@ export default (logger, dir, { files = [], fix = false } = {}) => (async () => {
const configFile = path.join(dir, '.eslintrc.json');
const config = fs.existsSync(configFile) ? fs.smartRead(configFile) : {};
const plugins = Object.fromEntries(await Promise.all((config.plugins || [])
.map((p) => {
const [org, name] = p.includes('/') ? p.split('/') : ['', p];
return `${org}${org === '' ? '' : '/'}eslint-plugin-${name}`;
})
.map((p) => transform(p, 'eslint-plugin'))
.map((p) => import(p).then(({ default: d }) => [p, d]))));

const eslint = new ESLint({
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3253,6 +3253,11 @@ please-upgrade-node@^3.2.0:
dependencies:
semver-compare "^1.0.0"

plugin-name-to-package-name@0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/plugin-name-to-package-name/-/plugin-name-to-package-name-0.1.1.tgz#14ec03fc42a88b1aa5edb9c1132589bddfc35f57"
integrity sha512-TrfIKmAQzAvATMavKb+I5kNv24jmPBrQ71VPGc7RC8/n5FtRXr0ZRZ1GxVfcJw06/VSM/zAGyI5CKcxWMSwT6A==

postcss@^8.1.10:
version "8.4.16"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.16.tgz#33a1d675fac39941f5f445db0de4db2b6e01d43c"
Expand Down

0 comments on commit 7d3bf44

Please sign in to comment.