Skip to content

Commit

Permalink
Split eslint JXA config into own package
Browse files Browse the repository at this point in the history
  • Loading branch information
targendaz2 committed May 8, 2024
1 parent a06354e commit 21f6827
Show file tree
Hide file tree
Showing 13 changed files with 88 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ jobs:
if: ${{ always() }}
with:
name: test results (${{ matrix.os }})
path: reports/${{ matrix.os }}.xml
path: packages/msda/reports/${{ matrix.os }}.xml
reporter: jest-junit
27 changes: 3 additions & 24 deletions packages/msda/eslint.config.mjs → eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @ts-check
import eslint from '@eslint/js';
import eslintConfigJxa from 'eslint-config-jxa';
import eslintConfigPrettier from 'eslint-config-prettier';
import tseslint from 'typescript-eslint';

Expand All @@ -11,30 +12,8 @@ const config = tseslint.config(
...tseslint.configs.recommended,
eslintConfigPrettier,
{
files: ['src/**/*.ts'],
rules: {
'no-restricted-imports': [
'error',
{
patterns: ['node:*'],
},
],
'no-restricted-syntax': [
'error',
{
selector: 'AwaitExpression',
message: 'JXA does not support async JavaScript.',
},
{
selector: 'ExportDefaultDeclaration',
message: 'Webpack breaks default exports in JXA code.',
},
{
selector: 'SpreadElement',
message: 'JXA does not support the spread operator.',
},
],
},
files: ['packages/msda/src/**/*.ts'],
...eslintConfigJxa,
},
{
rules: {
Expand Down
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
"bugs": {
"url": "https://github.com/targendaz2/Mac-Set-Default-Apps/issues"
},
"devDependencies": {
"@eslint/js": "^9.0.0",
"@types/eslint-config-prettier": "^6.11.3",
"@types/eslint__js": "^8.42.3",
"eslint": "^8.56.0",
"eslint-config-jxa": "workspace:^",
"eslint-config-prettier": "^9.1.0",
"typescript-eslint": "^7.6.0"
},
"workspaces": [
"packages/*"
],
Expand Down
Empty file.
Empty file.
24 changes: 24 additions & 0 deletions packages/eslint-config-jxa/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "eslint-config-jxa",
"version": "0.1.0",
"description": "",
"license": "MIT",
"main": "./src/index.js",
"types": "./src/index.d.ts",
"type": "module",
"peerDependencies": {
"eslint": ">=8.0.0"
},
"devDependencies": {
"@eslint/js": "^9.0.0",
"@types/eslint__js": "^8.42.3",
"@types/node": "^20.12.7",
"eslint": "^8.56.0",
"ts-node": "^10.9.2",
"typescript": "^5.4.5",
"typescript-eslint": "^7.6.0"
},
"engines": {
"node": "^21.0.0"
}
}
1 change: 1 addition & 0 deletions packages/eslint-config-jxa/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const rules: Record<string, 0 | "off">;
25 changes: 25 additions & 0 deletions packages/eslint-config-jxa/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export default {
rules: {
'no-restricted-imports': [
'error',
{
patterns: ['node:*'],
},
],
'no-restricted-syntax': [
'error',
{
selector: 'AwaitExpression',
message: 'JXA does not support async JavaScript.',
},
{
selector: 'ExportDefaultDeclaration',
message: 'Webpack breaks default exports in JXA code.',
},
{
selector: 'SpreadElement',
message: 'JXA does not support the spread operator.',
},
],
},
};
Empty file added packages/jxa-run/LICENSE
Empty file.
Empty file added packages/jxa-run/README.md
Empty file.
10 changes: 1 addition & 9 deletions packages/jxa-run/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,9 @@
"test": "jest"
},
"devDependencies": {
"@eslint/js": "^9.0.0",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/eslint-config-prettier": "^6.11.3",
"@types/eslint__js": "^8.42.3",
"@types/node": "^20.12.7",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"prettier": "^3.2.5",
"ts-node": "^10.9.2",
"typescript": "^5.4.5",
"typescript-eslint": "^7.6.0"
"typescript": "^5.4.5"
},
"engines": {
"node": "^21.0.0"
Expand Down
6 changes: 0 additions & 6 deletions packages/msda/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,13 @@
"test:unit": "jest tests/unit"
},
"devDependencies": {
"@eslint/js": "^9.0.0",
"@faker-js/faker": "^8.4.1",
"@jest/globals": "^29.7.0",
"@jxa/global-type": "^1.3.6",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/eslint-config-prettier": "^6.11.3",
"@types/eslint__js": "^8.42.3",
"@types/node": "^20.12.7",
"@types/tmp": "^0.2.6",
"cspell": "^8.6.1",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"fishery": "^2.2.2",
"jest": "^29.7.0",
"jest-junit": "^16.0.0",
Expand All @@ -69,7 +64,6 @@
"ts-node": "^10.9.2",
"tsconfig-jxa": "workspace:^",
"typescript": "^5.4.5",
"typescript-eslint": "^7.6.0",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4",
"webpack-shell-plugin-next": "^2.3.1"
Expand Down
38 changes: 24 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3022,6 +3022,22 @@ __metadata:
languageName: node
linkType: hard

"eslint-config-jxa@workspace:^, eslint-config-jxa@workspace:packages/eslint-config-jxa":
version: 0.0.0-use.local
resolution: "eslint-config-jxa@workspace:packages/eslint-config-jxa"
dependencies:
"@eslint/js": "npm:^9.0.0"
"@types/eslint__js": "npm:^8.42.3"
"@types/node": "npm:^20.12.7"
eslint: "npm:^8.56.0"
ts-node: "npm:^10.9.2"
typescript: "npm:^5.4.5"
typescript-eslint: "npm:^7.6.0"
peerDependencies:
eslint: ">=8.0.0"
languageName: unknown
linkType: soft

"eslint-config-prettier@npm:^9.1.0":
version: 9.1.0
resolution: "eslint-config-prettier@npm:9.1.0"
Expand Down Expand Up @@ -4545,17 +4561,9 @@ __metadata:
version: 0.0.0-use.local
resolution: "jxa-run@workspace:packages/jxa-run"
dependencies:
"@eslint/js": "npm:^9.0.0"
"@trivago/prettier-plugin-sort-imports": "npm:^4.3.0"
"@types/eslint-config-prettier": "npm:^6.11.3"
"@types/eslint__js": "npm:^8.42.3"
"@types/node": "npm:^20.12.7"
eslint: "npm:^8.56.0"
eslint-config-prettier: "npm:^9.1.0"
prettier: "npm:^3.2.5"
ts-node: "npm:^10.9.2"
typescript: "npm:^5.4.5"
typescript-eslint: "npm:^7.6.0"
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -4981,18 +4989,13 @@ __metadata:
version: 0.0.0-use.local
resolution: "msda@workspace:packages/msda"
dependencies:
"@eslint/js": "npm:^9.0.0"
"@faker-js/faker": "npm:^8.4.1"
"@jest/globals": "npm:^29.7.0"
"@jxa/global-type": "npm:^1.3.6"
"@trivago/prettier-plugin-sort-imports": "npm:^4.3.0"
"@types/eslint-config-prettier": "npm:^6.11.3"
"@types/eslint__js": "npm:^8.42.3"
"@types/node": "npm:^20.12.7"
"@types/tmp": "npm:^0.2.6"
cspell: "npm:^8.6.1"
eslint: "npm:^8.56.0"
eslint-config-prettier: "npm:^9.1.0"
fishery: "npm:^2.2.2"
jest: "npm:^29.7.0"
jest-junit: "npm:^16.0.0"
Expand All @@ -5006,7 +5009,6 @@ __metadata:
ts-node: "npm:^10.9.2"
tsconfig-jxa: "workspace:^"
typescript: "npm:^5.4.5"
typescript-eslint: "npm:^7.6.0"
webpack: "npm:^5.91.0"
webpack-cli: "npm:^5.1.4"
webpack-shell-plugin-next: "npm:^2.3.1"
Expand Down Expand Up @@ -5489,6 +5491,14 @@ __metadata:
"root-workspace-0b6124@workspace:.":
version: 0.0.0-use.local
resolution: "root-workspace-0b6124@workspace:."
dependencies:
"@eslint/js": "npm:^9.0.0"
"@types/eslint-config-prettier": "npm:^6.11.3"
"@types/eslint__js": "npm:^8.42.3"
eslint: "npm:^8.56.0"
eslint-config-jxa: "workspace:^"
eslint-config-prettier: "npm:^9.1.0"
typescript-eslint: "npm:^7.6.0"
languageName: unknown
linkType: soft

Expand Down

0 comments on commit 21f6827

Please sign in to comment.