Skip to content

Commit

Permalink
Merge branch 'main' into explicit-return-type-jsx
Browse files Browse the repository at this point in the history
  • Loading branch information
merrywhether committed Oct 16, 2023
2 parents 00dda33 + 3d58813 commit 7ef3ec4
Show file tree
Hide file tree
Showing 190 changed files with 3,207 additions and 1,299 deletions.
6 changes: 6 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Expand Up @@ -6,3 +6,9 @@ contact_links:
- name: Getting Started Guide
about: If you're looking for help setting up check out our getting started guide
url: https://typescript-eslint.io
- name: Ask a question on Discord
about: If you just want to ask a question, consider asking it on Discord!
url: https://discord.gg/FSxKq8Tdyg
- name: Ask a question on StackOverflow
about: If you just want to ask a question, consider asking it on StackOverflow!
url: https://stackoverflow.com/questions/tagged/typescript-eslint
53 changes: 0 additions & 53 deletions .github/workflows/ci.yml
Expand Up @@ -240,59 +240,6 @@ jobs:
CI: true
TYPESCRIPT_ESLINT_EXPERIMENTAL_TSSERVER: true

website_tests:
permissions:
contents: read # to fetch code (actions/checkout)

name: Website tests
# We technically do not need to wait for build within the pipeline any more because the build we care about is happening within Netlify, however,
# it is highly likely that if the CI one fails, the Netlify one will as well, so in order to not waste unncessary Github Actions minutes/resources,
# we do still keep this requirement here.
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Install
uses: ./.github/actions/prepare-install
with:
node-version: ${{ env.PRIMARY_NODE_VERSION }}

- name: Build website
if: github.repository != 'typescript-eslint/typescript-eslint' || github.ref != 'refs/heads/main'
run: NX_VERBOSE_LOGGING=true yarn nx build website

- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium

- name: Wait for Netlify deployment
if: github.repository == 'typescript-eslint/typescript-eslint' && github.ref == 'refs/heads/main'
uses: ./.github/actions/wait-for-netlify
id: waitForDeployment
with:
netlify_token: ${{ secrets.NETLIFY_TOKEN }}

- name: Run Playwright tests against the Netlify deployment
if: github.repository == 'typescript-eslint/typescript-eslint' && github.ref == 'refs/heads/main'
run: yarn playwright test --reporter=list
working-directory: packages/website
env:
PLAYWRIGHT_TEST_BASE_URL: ${{ steps.waitForDeployment.outputs.url }}

- name: Run Playwright tests against local deployment
if: github.repository != 'typescript-eslint/typescript-eslint' || github.ref != 'refs/heads/main'
run: yarn playwright test --reporter=list
working-directory: packages/website

- if: always()
uses: actions/upload-artifact@v3
with:
name: playwright-report
path: packages/website/playwright-report

upload_coverage:
name: Upload Codecov Coverage
needs: [unit_tests]
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Expand Up @@ -9,10 +9,7 @@ yarn-error.log*
packages/website/.docusaurus
packages/website/.cache-loader
packages/website/build
packages/website/playwright-report
packages/website/playwright/.cache
packages/website/static/sandbox
packages/website/test-results

# Runtime data
pids
Expand Down
1 change: 0 additions & 1 deletion .prettierignore
Expand Up @@ -29,7 +29,6 @@ CHANGELOG.md

packages/website/.docusaurus
packages/website/build
packages/website/playwright-report

# see the file header in eslint-base.test.js for more info
packages/rule-tester/tests/eslint-base
13 changes: 13 additions & 0 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,19 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [6.7.5](https://github.com/typescript-eslint/typescript-eslint/compare/v6.7.4...v6.7.5) (2023-10-09)


### Bug Fixes

* **eslint-plugin:** [prefer-string-starts-ends-with] only report slice/substring with correct range ([#7712](https://github.com/typescript-eslint/typescript-eslint/issues/7712)) ([db40a0a](https://github.com/typescript-eslint/typescript-eslint/commit/db40a0a83abf14237a7a9b3f75d869da26512292))

You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.





## [6.7.4](https://github.com/typescript-eslint/typescript-eslint/compare/v6.7.3...v6.7.4) (2023-10-02)

**Note:** Version bump only for package @typescript-eslint/typescript-eslint
Expand Down
2 changes: 1 addition & 1 deletion docs/contributing/Local_Development.mdx
Expand Up @@ -40,7 +40,7 @@ You can also perform them locally.

We use [Prettier](https://prettier.io) to auto-format code.
A Git pre-commit hook should apply it to all committed changes.
ALternately, you can run `yarn format` in any package or in the root.
Alternately, you can run `yarn format` in any package or in the root.

### Linting

Expand Down
52 changes: 52 additions & 0 deletions docs/developers/Custom_Rules.mdx
Expand Up @@ -121,6 +121,58 @@ export const rule = ESLintUtils.RuleCreator.withoutDocs({
We recommend any custom ESLint rule include a descriptive error message and link to informative documentation.
:::

## Handling rule options

ESLint rules can take options. When handling options, you will need to add information in at most three places:

- The `Options` generic type argument to `RuleCreator`, where you declare the type of the options
- The `meta.schema` property, where you add a JSON schema describing the options shape
- The `defaultOptions` property, where you add the default options value

```ts
type MessageIds = 'lowercase' | 'uppercase';

type Options = [
{
preferredCase: 'lower' | 'upper';
},
];

export const rule = createRule<Options, MessageIds>({
meta: {
// ...
schema: [
{
type: 'object',
properties: {
preferredCase: {
type: 'string',
enum: ['lower', 'upper'],
},
},
additionalProperties: false,
},
],
},
defaultOptions: [
{
preferredCase: 'lower',
},
],
create(context, options) {
if (options[0].preferredCase === 'lower') {
// ...
}
},
});
```

:::warning

When reading the options, use the second parameter of the `create` function, not `context.options` from the first parameter. The first is created by ESLint and does not have the default options applied.

:::

## AST Extensions

`@typescript-eslint/estree` creates AST nodes for TypeScript syntax with names that begin with `TS`, such as `TSInterfaceDeclaration` and `TSTypeAnnotation`.
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
@@ -1,6 +1,6 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"version": "6.7.4",
"version": "6.7.5",
"npmClient": "yarn",
"stream": true,
"command": {
Expand Down
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -46,7 +46,6 @@
"start": "nx run website:start",
"test": "nx run-many --target=test --parallel --exclude integration-tests --exclude website --exclude website-eslint",
"test-integration": "nx run integration-tests:test",
"test-website": "nx run-many --target=test --projects=website,website-eslint",
"typecheck": "nx run-many --target=typecheck --parallel"
},
"engines": {
Expand Down
10 changes: 10 additions & 0 deletions packages/ast-spec/CHANGELOG.md
Expand Up @@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [6.7.5](https://github.com/typescript-eslint/typescript-eslint/compare/v6.7.4...v6.7.5) (2023-10-09)

**Note:** Version bump only for package @typescript-eslint/ast-spec

You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.





## [6.7.4](https://github.com/typescript-eslint/typescript-eslint/compare/v6.7.3...v6.7.4) (2023-10-02)

**Note:** Version bump only for package @typescript-eslint/ast-spec
Expand Down
2 changes: 1 addition & 1 deletion packages/ast-spec/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/ast-spec",
"version": "6.7.4",
"version": "6.7.5",
"description": "Complete specification for the TypeScript-ESTree AST",
"private": true,
"keywords": [
Expand Down
10 changes: 10 additions & 0 deletions packages/eslint-plugin-internal/CHANGELOG.md
Expand Up @@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [6.7.5](https://github.com/typescript-eslint/typescript-eslint/compare/v6.7.4...v6.7.5) (2023-10-09)

**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal

You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.





## [6.7.4](https://github.com/typescript-eslint/typescript-eslint/compare/v6.7.3...v6.7.4) (2023-10-02)

**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal
Expand Down
10 changes: 5 additions & 5 deletions packages/eslint-plugin-internal/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/eslint-plugin-internal",
"version": "6.7.4",
"version": "6.7.5",
"private": true,
"main": "dist/index.js",
"scripts": {
Expand All @@ -14,10 +14,10 @@
},
"dependencies": {
"@types/prettier": "*",
"@typescript-eslint/rule-tester": "6.7.4",
"@typescript-eslint/scope-manager": "6.7.4",
"@typescript-eslint/type-utils": "6.7.4",
"@typescript-eslint/utils": "6.7.4",
"@typescript-eslint/rule-tester": "6.7.5",
"@typescript-eslint/scope-manager": "6.7.5",
"@typescript-eslint/type-utils": "6.7.5",
"@typescript-eslint/utils": "6.7.5",
"prettier": "^2.8.4"
},
"devDependencies": {
Expand Down
10 changes: 10 additions & 0 deletions packages/eslint-plugin-tslint/CHANGELOG.md
Expand Up @@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [6.7.5](https://github.com/typescript-eslint/typescript-eslint/compare/v6.7.4...v6.7.5) (2023-10-09)

**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint

You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.





## [6.7.4](https://github.com/typescript-eslint/typescript-eslint/compare/v6.7.3...v6.7.4) (2023-10-02)

**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint
Expand Down
6 changes: 3 additions & 3 deletions packages/eslint-plugin-tslint/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/eslint-plugin-tslint",
"version": "6.7.4",
"version": "6.7.5",
"main": "dist/index.js",
"typings": "src/index.ts",
"description": "ESLint plugin that wraps a TSLint configuration and lints the whole source using TSLint",
Expand Down Expand Up @@ -46,7 +46,7 @@
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"dependencies": {
"@typescript-eslint/utils": "6.7.4"
"@typescript-eslint/utils": "6.7.5"
},
"peerDependencies": {
"eslint": "^7.0.0 || ^8.0.0",
Expand All @@ -55,7 +55,7 @@
},
"devDependencies": {
"@types/lodash": "*",
"@typescript-eslint/parser": "6.7.4",
"@typescript-eslint/parser": "6.7.5",
"jest": "29.7.0",
"prettier": "^2.8.4",
"rimraf": "*"
Expand Down
13 changes: 13 additions & 0 deletions packages/eslint-plugin/CHANGELOG.md
Expand Up @@ -3,6 +3,19 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [6.7.5](https://github.com/typescript-eslint/typescript-eslint/compare/v6.7.4...v6.7.5) (2023-10-09)


### Bug Fixes

* **eslint-plugin:** [prefer-string-starts-ends-with] only report slice/substring with correct range ([#7712](https://github.com/typescript-eslint/typescript-eslint/issues/7712)) ([db40a0a](https://github.com/typescript-eslint/typescript-eslint/commit/db40a0a83abf14237a7a9b3f75d869da26512292))

You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.





## [6.7.4](https://github.com/typescript-eslint/typescript-eslint/compare/v6.7.3...v6.7.4) (2023-10-02)

**Note:** Version bump only for package @typescript-eslint/eslint-plugin
Expand Down
Expand Up @@ -293,9 +293,11 @@ You may pass function/method names you would like this rule to ignore, like so:
}
```

### `allowIIFE`
### `allowIIFEs`

Examples of code for this rule with `{ allowIIFE: true }`:
Examples of code for this rule with `{ allowIIFEs: true }`:

<!--tabs-->

#### ❌ Incorrect

Expand Down
31 changes: 1 addition & 30 deletions packages/eslint-plugin/docs/rules/no-explicit-any.md
Expand Up @@ -98,7 +98,7 @@ function greet(param: Array<string>): Array<string> {}

A boolean to specify if arrays from the rest operator are considered okay. `false` by default.

Examples of **incorrect** code for the `{ "ignoreRestArgs": false }` option:
The examples below are **incorrect** when `{ignoreRestArgs: false}`, but **correct** when `{ignoreRestArgs: true}`.

```ts
/*eslint @typescript-eslint/no-explicit-any: ["error", { "ignoreRestArgs": false }]*/
Expand Down Expand Up @@ -127,35 +127,6 @@ interface Garply {
}
```

Examples of **correct** code for the `{ "ignoreRestArgs": true }` option:

```ts
/*eslint @typescript-eslint/no-explicit-any: ["error", { "ignoreRestArgs": true }]*/

function foo1(...args: any[]): void {}
function foo2(...args: readonly any[]): void {}
function foo3(...args: Array<any>): void {}
function foo4(...args: ReadonlyArray<any>): void {}

declare function bar(...args: any[]): void;

const baz = (...args: any[]) => {};
const qux = function (...args: any[]) {};

type Quux = (...args: any[]) => void;
type Quuz = new (...args: any[]) => void;

interface Grault {
(...args: any[]): void;
}
interface Corge {
new (...args: any[]): void;
}
interface Garply {
f(...args: any[]): void;
}
```

## When Not To Use It

If an unknown type or a library without typings is used
Expand Down

0 comments on commit 7ef3ec4

Please sign in to comment.