Skip to content

Commit

Permalink
chore: format all files (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjermanovic committed May 14, 2024
1 parent 3e9eb67 commit d5a0496
Show file tree
Hide file tree
Showing 32 changed files with 3,242 additions and 2,852 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,25 @@ on:
- main

jobs:
verify_files:
name: Verify Files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: "lts/*"

- name: Install Packages
run: npm install

- name: Lint Files
run: npm run lint

- name: Check Formatting
run: npm run fmt:check

build:
runs-on: ${{ matrix.os }}

Expand Down
60 changes: 30 additions & 30 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
# Output which releases were created
- name: Output release info
run: |
echo "releases_created:" ${{ steps.release.outputs.releases_created }}
echo "packages/compat--release_created:" ${{ steps.release.outputs['packages/compat--release_created'] }}
echo "packages/object-schema--release_created:" ${{ steps.release.outputs['packages/object-schema--release_created'] }}
echo "packages/config-array--release_created" ${{ steps.release.outputs['packages/config-array--release_created'] }}
echo "releases_created:" ${{ steps.release.outputs.releases_created }}
echo "packages/compat--release_created:" ${{ steps.release.outputs['packages/compat--release_created'] }}
echo "packages/object-schema--release_created:" ${{ steps.release.outputs['packages/object-schema--release_created'] }}
echo "packages/config-array--release_created" ${{ steps.release.outputs['packages/config-array--release_created'] }}
# Check to see if we need to do any releases and if so check out the repo
- uses: actions/checkout@v4
Expand All @@ -39,8 +39,8 @@ jobs:
registry-url: "https://registry.npmjs.org"

- run: |
npm install
npm run build
npm install
npm run build
if: ${{ steps.release.outputs.releases_created == 'true' }}
#-----------------------------------------------------------------------------
Expand All @@ -61,28 +61,28 @@ jobs:

- name: Publish @eslint/compat package to JSR
run: |
npm run build --if-present
npx jsr publish
npm run build --if-present
npx jsr publish
working-directory: packages/compat
if: ${{ steps.release.outputs['packages/compat--release_created'] }}

- name: Tweet Release Announcement
run: npx @humanwhocodes/tweet "@eslint/compat v${{ steps.release.outputs['packages/compat--major'] }}.${{ steps.release.outputs['packages/compat--minor'] }}.${{ steps.release.outputs['packages/compat--patch'] }} has been released!\n\n${{ github.event.repository.html_url }}/releases/tag/v${{ steps.release.outputs['packages/compat--tag_name'] }}"
if: ${{ steps.release.outputs['packages/compat--release_created'] }}
env:
TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }}
TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
TWITTER_ACCESS_TOKEN_KEY: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }}
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }}
TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
TWITTER_ACCESS_TOKEN_KEY: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }}
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}

- name: Toot Release Announcement
run: npx @humanwhocodes/toot "@eslint/compat v${{ steps.release.outputs['packages/compat--major'] }}.${{ steps.release.outputs['packages/compat--minor'] }}.${{ steps.release.outputs['packages/compat--patch'] }} has been released!\n\n${{ github.event.repository.html_url }}/releases/tag/v${{ steps.release.outputs['packages/compat--tag_name'] }}"'
if: ${{ steps.release.outputs['packages/compat--release_created'] }}
env:
MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}
MASTODON_HOST: ${{ secrets.MASTODON_HOST }}
MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}
MASTODON_HOST: ${{ secrets.MASTODON_HOST }}

#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# @eslint/object-schema
#-----------------------------------------------------------------------------

Expand All @@ -101,17 +101,17 @@ jobs:
run: npx @humanwhocodes/tweet "@eslint/object-schema v${{ steps.release.outputs['packages/object-schema--major'] }}.${{ steps.release.outputs['packages/object-schema--minor'] }}.${{ steps.release.outputs['packages/object-schema--patch'] }} has been released!\n\n${{ github.event.repository.html_url }}/releases/tag/v${{ steps.release.outputs['packages/object-schema--tag_name'] }}"
if: ${{ steps.release.outputs['packages/object-schema--release_created'] }}
env:
TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }}
TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
TWITTER_ACCESS_TOKEN_KEY: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }}
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }}
TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
TWITTER_ACCESS_TOKEN_KEY: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }}
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}

- name: Toot Release Announcement
run: npx @humanwhocodes/toot "@eslint/object-schema v${{ steps.release.outputs['packages/object-schema--major'] }}.${{ steps.release.outputs['packages/object-schema--minor'] }}.${{ steps.release.outputs['packages/object-schema--patch'] }} has been released!\n\n${{ github.event.repository.html_url }}/releases/tag/v${{ steps.release.outputs['packages/object-schema--tag_name'] }}"'
if: ${{ steps.release.outputs['packages/object-schema--release_created'] }}
env:
MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}
MASTODON_HOST: ${{ secrets.MASTODON_HOST }}
MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}
MASTODON_HOST: ${{ secrets.MASTODON_HOST }}

#-----------------------------------------------------------------------------
# @eslint/config-array
Expand All @@ -132,14 +132,14 @@ jobs:
run: npx @humanwhocodes/tweet "@eslint/config-array v${{ steps.release.outputs['packages/config-array--major'] }}.${{ steps.release.outputs['packages/config-array--minor'] }}.${{ steps.release.outputs['packages/config-array--patch'] }} has been released!\n\n${{ github.event.repository.html_url }}/releases/tag/v${{ steps.release.outputs['packages/config-array--tag_name'] }}"
if: ${{ steps.release.outputs['packages/config-array--release_created'] }}
env:
TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }}
TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
TWITTER_ACCESS_TOKEN_KEY: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }}
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }}
TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
TWITTER_ACCESS_TOKEN_KEY: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }}
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}

- name: Toot Release Announcement
run: npx @humanwhocodes/toot "@eslint/config-array v${{ steps.release.outputs['packages/config-array--major'] }}.${{ steps.release.outputs['packages/config-array--minor'] }}.${{ steps.release.outputs['packages/config-array--patch'] }} has been released!\n\n${{ github.event.repository.html_url }}/releases/tag/v${{ steps.release.outputs['packages/config-array--tag_name'] }}"'
if: ${{ steps.release.outputs['packages/config-array--release_created'] }}
env:
MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}
MASTODON_HOST: ${{ secrets.MASTODON_HOST }}
MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}
MASTODON_HOST: ${{ secrets.MASTODON_HOST }}
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
dist
CHANGELOG.md
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

Monorepo for the rewrite of ESLint.


## Packages

This repository is the home of the following packages:

* [`@eslint/object-schema`](packages/object-schema)
* [`@eslint/config-array`](packages/config-array)
* [`@eslint/compat`](packages/compat)
- [`@eslint/object-schema`](packages/object-schema)
- [`@eslint/config-array`](packages/config-array)
- [`@eslint/compat`](packages/compat)
6 changes: 3 additions & 3 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default [
afterEach: "readonly",
before: "readonly",
after: "readonly",
}
}
}
},
},
},
];
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"build": "node scripts/build.js",
"lint": "eslint .",
"lint:fix": "eslint --fix .",
"fmt": "prettier --write ."
"fmt": "prettier --write .",
"fmt:check": "prettier --check ."
},
"workspaces": [
"packages/*"
Expand All @@ -20,7 +21,8 @@
"*.js": [
"eslint --fix",
"prettier --write"
]
],
"!(*.js)": "prettier --write --ignore-unknown"
},
"devDependencies": {
"@eslint/js": "^9.0.0",
Expand Down
59 changes: 29 additions & 30 deletions packages/compat/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# ESLint Compatibility Utilities


## Overview

This packages contains functions that allow you to wrap existing ESLint rules, plugins, and configurations that were intended for use with ESLint v8.x to allow them to work as-is in ESLint v9.x.
Expand Down Expand Up @@ -29,9 +28,9 @@ deno add @eslint/compat

This package exports the following functions in both ESM and CommonJS format:

* `fixupRule(rule)` - wraps the given rule in a compatibility layer and returns the result
* `fixupPluginRules(plugin)` - wraps each rule in the given plugin using `fixupRule()` and returns a new object that represents the plugin with the fixed-up rules
* `fixupConfigRules(configs)` - wraps all plugins found in an array of config objects using `fixupPluginRules()`
- `fixupRule(rule)` - wraps the given rule in a compatibility layer and returns the result
- `fixupPluginRules(plugin)` - wraps each rule in the given plugin using `fixupRule()` and returns a new object that represents the plugin with the fixed-up rules
- `fixupConfigRules(configs)` - wraps all plugins found in an array of config objects using `fixupPluginRules()`

### Fixing Rules

Expand Down Expand Up @@ -77,15 +76,15 @@ import { fixupPluginRules } from "@eslint/compat";
import somePlugin from "eslint-plugin-some-plugin";

export default [
{
plugins: {
// insert the fixed plugin instead of the original
somePlugin: fixupPluginRules(somePlugin)
},
rules: {
"somePlugin/rule-name": "error"
}
}
{
plugins: {
// insert the fixed plugin instead of the original
somePlugin: fixupPluginRules(somePlugin),
},
rules: {
"somePlugin/rule-name": "error",
},
},
];
```

Expand All @@ -97,15 +96,15 @@ const { fixupPluginRules } = require("@eslint/compat");
const somePlugin = require("eslint-plugin-some-plugin");

module.exports = [
{
plugins: {
// insert the fixed plugin instead of the original
somePlugin: fixupPluginRules(somePlugin)
},
rules: {
"somePlugin/rule-name": "error"
}
}
{
plugins: {
// insert the fixed plugin instead of the original
somePlugin: fixupPluginRules(somePlugin),
},
rules: {
"somePlugin/rule-name": "error",
},
},
];
```

Expand All @@ -119,10 +118,10 @@ import { fixupConfigRules } from "@eslint/compat";
import someConfig from "eslint-config-some-config";

export default [
...fixupConfigRules(someConfig),
{
// your overrides
}
...fixupConfigRules(someConfig),
{
// your overrides
},
];
```

Expand All @@ -134,10 +133,10 @@ const { fixupConfigRules } = require("@eslint/compat");
const someConfig = require("eslint-config-some-config");

module.exports = [
...fixupConfigRules(someConfig),
{
// your overrides
}
...fixupConfigRules(someConfig),
{
// your overrides
},
];
```

Expand Down
28 changes: 14 additions & 14 deletions packages/compat/jsr.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "@eslint/compat",
"version": "1.0.1",
"exports": "./dist/esm/index.js",
"publish": {
"include": [
"dist/esm/index.js",
"dist/esm/index.d.ts",
"dist/esm/types.d.ts",
"dist/esm/types.ts",
"README.md",
"jsr.json",
"LICENSE"
]
}
"name": "@eslint/compat",
"version": "1.0.1",
"exports": "./dist/esm/index.js",
"publish": {
"include": [
"dist/esm/index.js",
"dist/esm/index.d.ts",
"dist/esm/types.d.ts",
"dist/esm/types.ts",
"README.md",
"jsr.json",
"LICENSE"
]
}
}
28 changes: 14 additions & 14 deletions packages/compat/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,26 @@
export type FixupLegacyRuleDefinition = (context: Object) => Object;

export interface FixupRuleDefinition {
meta?: Object;
create(context: Object): Object;
meta?: Object;
create(context: Object): Object;
}

export interface FixupPluginDefinition {
meta?: Object;
rules?: Record<string, FixupRuleDefinition>;
configs?: Record<string, Object>;
processors?: Record<string, Object>;
meta?: Object;
rules?: Record<string, FixupRuleDefinition>;
configs?: Record<string, Object>;
processors?: Record<string, Object>;
}

export interface FixupConfig {
files?: Array<string>;
ignores?: Array<string>;
name?: string;
languageOptions?: Record<string, any>;
linterOptions?: Record<string, any>;
processor?: string|Object;
plugins?: Record<string, FixupPluginDefinition>;
rules?: Record<string, any>;
files?: Array<string>;
ignores?: Array<string>;
name?: string;
languageOptions?: Record<string, any>;
linterOptions?: Record<string, any>;
processor?: string | Object;
plugins?: Record<string, FixupPluginDefinition>;
rules?: Record<string, any>;
}

export type FixupConfigArray = Array<FixupConfig>;
2 changes: 1 addition & 1 deletion packages/compat/tsconfig.cjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"outDir": "dist/cjs",
"moduleResolution": "Bundler",
"module": "Preserve"
},
}
}
2 changes: 1 addition & 1 deletion packages/compat/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": "./tsconfig.json",
"files": ["dist/esm/index.js"],
"files": ["dist/esm/index.js"]
}
Loading

0 comments on commit d5a0496

Please sign in to comment.