Skip to content

Commit 85a78aa

Browse files
authored
Merge pull request #28 from joshuajaco/maintenance
Maintenance
2 parents 1aeac3b + 2296a5e commit 85a78aa

File tree

11 files changed

+455
-398
lines changed

11 files changed

+455
-398
lines changed
Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
1-
"use strict";
2-
3-
module.exports = {
4-
env: {
5-
node: 1,
6-
mocha: 1,
7-
},
8-
parserOptions: {
9-
ecmaVersion: 2021,
10-
},
11-
plugins: ["node", "eslint-plugin", "prettier"],
12-
extends: [
1+
{
2+
"root": true,
3+
"reportUnusedDisableDirectives": true,
4+
"env": { "node": true, "mocha": true },
5+
"plugins": ["node", "eslint-plugin"],
6+
"extends": [
137
"eslint:recommended",
148
"plugin:node/recommended",
159
"plugin:eslint-plugin/all",
10+
"prettier"
1611
],
17-
rules: {
12+
"rules": {
1813
"arrow-body-style": "error",
19-
"no-use-before-define": "error",
20-
strict: "error",
14+
"strict": "error",
2115
"node/prefer-global/buffer": "error",
2216
"node/prefer-global/console": "error",
2317
"node/prefer-global/process": "error",
@@ -27,10 +21,8 @@ module.exports = {
2721
"eslint-plugin/require-meta-docs-url": [
2822
"error",
2923
{
30-
pattern:
31-
"https://github.com/joshuajaco/eslint-plugin-workspaces/blob/main/docs/rules/{{name}}.md",
32-
},
33-
],
34-
"prettier/prettier": "error",
35-
},
36-
};
24+
"pattern": "https://github.com/joshuajaco/eslint-plugin-workspaces/blob/main/docs/rules/{{name}}.md"
25+
}
26+
]
27+
}
28+
}

.github/workflows/node.js.yml renamed to .github/workflows/ci.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Node.js CI
1+
name: CI
22
on:
33
push:
44
branches: ["main"]
@@ -10,21 +10,22 @@ jobs:
1010
strategy:
1111
matrix:
1212
os: [ubuntu-latest, windows-latest]
13-
node-version: [18.16.0, 20.2.0]
13+
node-version: [18.18.2, 20.9.0]
1414
steps:
1515
- name: Set git to use LF
1616
run: |
1717
git config --global core.autocrlf false
1818
git config --global core.eol lf
19-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v4
2020
- name: Use Node.js ${{ matrix.node-version }}
21-
uses: actions/setup-node@v2
21+
uses: actions/setup-node@v4
2222
with:
2323
node-version: ${{ matrix.node-version }}
2424
cache: "npm"
2525
- run: npm ci
26+
- run: npm run format:check
27+
- run: npm run lint
2628
- run: npm test
27-
- run: npm run coverage
2829
- name: Coveralls
2930
uses: coverallsapp/github-action@master
3031
with:

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nodejs 20.2.0
1+
nodejs 20.9.0

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ Or add the "recommended" preset:
5050

5151
| | | Name | Description |
5252
| --- | --- | ------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
53-
| | 🔧 | [no-absolute-imports](https://github.com/joshuajaco/eslint-plugin-workspaces/blob/main/docs/rules/no-absolute-imports.md) | disallow absolute imports for files that are within the current package |
53+
|| 🔧 | [no-absolute-imports](https://github.com/joshuajaco/eslint-plugin-workspaces/blob/main/docs/rules/no-absolute-imports.md) | disallow absolute imports for files that are within the current package |
5454
| | | [no-cross-imports](https://github.com/joshuajaco/eslint-plugin-workspaces/blob/main/docs/rules/no-cross-imports.md) | disallow imports of files that are inside another package |
55-
| | 🔧 | [no-relative-imports](https://github.com/joshuajaco/eslint-plugin-workspaces/blob/main/docs/rules/no-relative-imports.md) | disallow relative imports of files that are outside of the current package |
56-
| | | [require-dependency](https://github.com/joshuajaco/eslint-plugin-workspaces/blob/main/docs/rules/require-dependency.md) | disallow importing from packages that are not listed as a dependency |
55+
|| 🔧 | [no-relative-imports](https://github.com/joshuajaco/eslint-plugin-workspaces/blob/main/docs/rules/no-relative-imports.md) | disallow relative imports of files that are outside of the current package |
56+
|| | [require-dependency](https://github.com/joshuajaco/eslint-plugin-workspaces/blob/main/docs/rules/require-dependency.md) | disallow importing from packages that are not listed as a dependency |
5757

5858
## Presets
5959

lib/rules/no-absolute-imports.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ module.exports.create = (context) => {
3636
fixer.replaceTextRange(
3737
[start + 1, end - 1],
3838
pathToImport(
39-
relative(dirname(filename), path.replace(name, location))
40-
)
39+
relative(dirname(filename), path.replace(name, location)),
40+
),
4141
),
4242
});
4343
}

lib/rules/no-cross-imports.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ module.exports.create = (context) => {
7171
if (!workspaces) return {};
7272

7373
const forbidden = workspaces.filter(
74-
({ package: { name } }) => !allowed.includes(name)
74+
({ package: { name } }) => !allowed.includes(name),
7575
);
7676

7777
return getImport(
@@ -83,8 +83,8 @@ module.exports.create = (context) => {
8383
filterSharedPackagesInCurrentScope(
8484
currentWorkspace,
8585
scopedEnabled,
86-
scopedSharingFolderName
87-
)
86+
scopedSharingFolderName,
87+
),
8888
)
8989
.forEach(({ package: { name }, location }) => {
9090
if (
@@ -98,6 +98,6 @@ module.exports.create = (context) => {
9898
});
9999
}
100100
});
101-
}
101+
},
102102
);
103103
};

lib/rules/no-relative-imports.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ module.exports.create = (context) => {
3434
fix: (fixer) =>
3535
fixer.replaceTextRange(
3636
[start + 1, end - 1],
37-
path.replace(location, name)
37+
path.replace(location, name),
3838
),
3939
});
4040
}
4141
});
42-
}
42+
},
4343
);
4444
};

lib/rules/require-dependency.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ module.exports.create = (context) => {
4444
});
4545
}
4646
});
47-
}
47+
},
4848
);
4949
};

lib/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const getImport = (workspaces, filename, callback) => {
4242
if (!workspaces) return {};
4343

4444
const currentWorkspace = workspaces.find(({ location }) =>
45-
isSubPath(location, filename)
45+
isSubPath(location, filename),
4646
);
4747

4848
if (!currentWorkspace) return {};
@@ -59,7 +59,7 @@ const getImport = (workspaces, filename, callback) => {
5959
(node.callee.type === "Identifier" && node.callee.name === "require"))
6060
) {
6161
callback(
62-
resolveImport(filename, node, node.arguments[0], currentWorkspace)
62+
resolveImport(filename, node, node.arguments[0], currentWorkspace),
6363
);
6464
}
6565
},

0 commit comments

Comments
 (0)