Skip to content

Commit

Permalink
Merge branch 'main'
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaKGoldberg committed Feb 5, 2023
2 parents 72a7436 + f330e06 commit 6573aa0
Show file tree
Hide file tree
Showing 1,348 changed files with 56,633 additions and 43,975 deletions.
9 changes: 9 additions & 0 deletions .cspell.json
Expand Up @@ -47,18 +47,22 @@
"autofix",
"autofixers",
"autofixes",
"automations",
"backticks",
"bigint",
"bivariant",
"blockless",
"blurple",
"camelcase",
"Cena",
"codebases",
"Codecov",
"contravariant",
"Crockford",
"declarators",
"destructure",
"destructured",
"discoverability",
"dprint",
"errored",
"erroring",
Expand All @@ -68,6 +72,7 @@
"esquery",
"esrecurse",
"estree",
"globby",
"IDE's",
"IIFE",
"IIFEs",
Expand Down Expand Up @@ -100,12 +105,15 @@
"ruleset",
"rulesets",
"serializers",
"Sourcegraph",
"superset",
"thenables",
"transpiled",
"transpiles",
"transpiling",
"triaging",
"tsconfigs",
"tseslint",
"tsutils",
"tsvfs",
"typedef",
Expand All @@ -114,6 +122,7 @@
"unoptimized",
"unprefixed",
"upsert",
"warnonunsupportedtypescriptversion",
"Zacher"
],
"overrides": [
Expand Down
137 changes: 96 additions & 41 deletions .eslintrc.js
@@ -1,12 +1,13 @@
module.exports = {
root: true,
plugins: [
'eslint-plugin',
'@typescript-eslint',
'jest',
'import',
'eslint-comments',
'@typescript-eslint/internal',
'deprecation',
'eslint-comments',
'eslint-plugin',
'import',
'jest',
'simple-import-sort',
],
env: {
Expand All @@ -15,6 +16,7 @@ module.exports = {
},
extends: [
'eslint:recommended',
'plugin:eslint-plugin/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
],
Expand All @@ -38,8 +40,16 @@ module.exports = {
tsconfigRootDir: __dirname,
warnOnUnsupportedTypeScriptVersion: false,
EXPERIMENTAL_useSourceOfProjectReferenceRedirect: false,
cacheLifetime: {
// we pretty well never create/change tsconfig structure - so need to ever evict the cache
// in the rare case that we do - just need to manually restart their IDE.
glob: 'Infinity',
},
},
rules: {
// make sure we're not leveraging any deprecated APIs
'deprecation/deprecation': 'error',

//
// our plugin :D
//
Expand All @@ -55,6 +65,10 @@ module.exports = {
},
],
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports', disallowTypeAnnotations: true },
],
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-empty-function': [
Expand Down Expand Up @@ -97,6 +111,13 @@ module.exports = {
//

curly: ['error', 'all'],
eqeqeq: [
'error',
'always',
{
null: 'never',
},
],
'no-mixed-operators': 'error',
'no-console': 'error',
'no-process-exit': 'error',
Expand Down Expand Up @@ -151,8 +172,10 @@ module.exports = {
'import/no-absolute-path': 'error',
// disallow AMD require/define
'import/no-amd': 'error',
// forbid default exports
// forbid default exports - we want to standardize on named exports so that imported names are consistent
'import/no-default-export': 'error',
// disallow imports from duplicate paths
'import/no-duplicates': 'error',
// Forbid the use of extraneous packages
'import/no-extraneous-dependencies': [
'error',
Expand All @@ -172,19 +195,24 @@ module.exports = {
'import/no-self-import': 'error',
// Require modules with a single export to use a default export
'import/prefer-default-export': 'off', // we want everything to be named

// enforce a sort order across the codebase
'simple-import-sort/imports': 'error',

'one-var': ['error', 'never'],
},
overrides: [
// all test files
{
files: [
'packages/*/tests/**/*.spec.ts',
'packages/*/tests/**/*.test.ts',
'packages/*/tests/**/spec.ts',
'packages/*/tests/**/test.ts',
'packages/parser/tests/**/*.ts',
'tests/integration/**/*.test.ts',
'tests/integration/integration-test-base.ts',
'tests/integration/pack-packages.ts',
'./packages/*/tests/**/*.spec.ts',
'./packages/*/tests/**/*.test.ts',
'./packages/*/tests/**/spec.ts',
'./packages/*/tests/**/test.ts',
'./packages/parser/tests/**/*.ts',
'./tests/integration/**/*.test.ts',
'./tests/integration/integration-test-base.ts',
'./tests/integration/pack-packages.ts',
],
env: {
'jest/globals': true,
Expand All @@ -194,13 +222,12 @@ module.exports = {
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'eslint-plugin/no-identical-tests': 'error',
'eslint-plugin/consistent-output': 'off', // Might eventually be removed from `eslint-plugin/recommended`: https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/issues/284
'jest/no-disabled-tests': 'warn',
'jest/no-focused-tests': 'error',
'jest/no-alias-methods': 'error',
'jest/no-identical-title': 'error',
'jest/no-jasmine-globals': 'error',
'jest/no-jest-import': 'error',
'jest/no-test-prefixes': 'error',
'jest/no-done-callback': 'error',
'jest/no-test-return-statement': 'error',
Expand All @@ -226,9 +253,9 @@ module.exports = {
// plugin source files
{
files: [
'packages/eslint-plugin-internal/**/*.ts',
'packages/eslint-plugin-tslint/**/*.ts',
'packages/eslint-plugin/**/*.ts',
'./packages/eslint-plugin-internal/**/*.ts',
'./packages/eslint-plugin-tslint/**/*.ts',
'./packages/eslint-plugin/**/*.ts',
],
rules: {
'@typescript-eslint/internal/no-typescript-estree-import': 'error',
Expand All @@ -237,31 +264,46 @@ module.exports = {
// plugin rule source files
{
files: [
'packages/eslint-plugin-internal/src/rules/**/*.ts',
'packages/eslint-plugin-tslint/src/rules/**/*.ts',
'packages/eslint-plugin/src/configs/**/*.ts',
'packages/eslint-plugin/src/rules/**/*.ts',
'./packages/eslint-plugin-internal/src/rules/**/*.ts',
'./packages/eslint-plugin-tslint/src/rules/**/*.ts',
'./packages/eslint-plugin/src/configs/**/*.ts',
'./packages/eslint-plugin/src/rules/**/*.ts',
],
rules: {
'eslint-plugin/require-meta-docs-description': [
'error',
{ pattern: '^(Enforce|Require|Disallow) .+[^. ]$' },
],

// specifically for rules - default exports makes the tooling easier
'import/no-default-export': 'off',

'no-restricted-syntax': [
'error',
{
selector:
'ExportDefaultDeclaration Property[key.name="create"] MemberExpression[object.name="context"][property.name="options"]',
message:
"Retrieve options from create's second parameter so that defaultOptions are applied.",
},
],
},
},
// plugin rule tests
{
files: [
'packages/eslint-plugin-internal/tests/rules/**/*.test.ts',
'packages/eslint-plugin-tslint/tests/rules/**/*.test.ts',
'packages/eslint-plugin/tests/rules/**/*.test.ts',
'packages/eslint-plugin/tests/eslint-rules/**/*.test.ts',
'./packages/eslint-plugin-internal/tests/rules/**/*.test.ts',
'./packages/eslint-plugin-tslint/tests/rules/**/*.test.ts',
'./packages/eslint-plugin/tests/rules/**/*.test.ts',
'./packages/eslint-plugin/tests/eslint-rules/**/*.test.ts',
],
rules: {
'@typescript-eslint/internal/plugin-test-formatting': 'error',
},
},
// files which list all the things
{
files: ['packages/eslint-plugin/src/rules/index.ts'],
files: ['./packages/eslint-plugin/src/rules/index.ts'],
rules: {
// enforce alphabetical ordering
'sort-keys': 'error',
Expand All @@ -279,30 +321,22 @@ module.exports = {
// generated files
{
files: [
'packages/scope-manager/src/lib/*.ts',
'packages/eslint-plugin/src/configs/*.ts',
'./packages/scope-manager/src/lib/*.ts',
'./packages/eslint-plugin/src/configs/*.ts',
],
rules: {
// allow console logs in tools and tests
'@typescript-eslint/internal/no-poorly-typed-ts-props': 'off',
'@typescript-eslint/internal/no-typescript-default-import': 'off',
'@typescript-eslint/internal/prefer-ast-types-enum': 'off',
},
},
// ast spec specific standardization
{
files: ['packages/ast-spec/src/**/*.ts'],
files: ['./packages/ast-spec/src/**/*.ts'],
rules: {
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports', disallowTypeAnnotations: true },
],
// disallow ALL unused vars
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/sort-type-union-intersection-members': 'error',
'import/first': 'error',
'import/newline-after-import': 'error',
'import/no-duplicates': 'error',
'simple-import-sort/imports': 'error',
'@typescript-eslint/sort-type-constituents': 'error',
},
},
{
Expand All @@ -312,9 +346,30 @@ module.exports = {
},
},
{
files: ['packages/website/src/**/*.{ts,tsx}'],
files: ['./packages/website/'],
extends: [
'plugin:jsx-a11y/recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
],
plugins: ['jsx-a11y', 'react', 'react-hooks'],
rules: {
'react/jsx-no-target-blank': 'off',
'react/no-unescaped-entities': 'off',
'@typescript-eslint/internal/prefer-ast-types-enum': 'off',
'react-hooks/exhaustive-deps': 'off', // TODO: enable it later
},
settings: {
react: {
version: 'detect',
},
},
},
{
files: ['./packages/website/src/**/*.{ts,tsx}'],
rules: {
'import/no-default-export': 'off',
// allow console logs in the website to help with debugging things in production
'no-console': 'off',
},
},
Expand Down
24 changes: 24 additions & 0 deletions .github/DISCUSSION_TEMPLATE/rfcs.yml
@@ -0,0 +1,24 @@
body:
- attributes:
label: RFC
value: |
Suggested changes...
id: rfc
type: textarea
- attributes:
label: Additional Info
value: |
Any additional info...
id: additional
type: textarea
- attributes:
label: Before you submit your RFC, please confirm the following. If any of these required steps are not taken, we may not be able to review your RFC. Help us to help you!
options:
- label: I have [searched for related discussions](https://github.com/typescript-eslint/typescript-eslint/discussions) and [searched for related issues](https://github.com/typescript-eslint/typescript-eslint/issues) and found none that match my proposal.
required: true
- label: I have [read the FAQ](https://typescript-eslint.io/linting/troubleshooting) and my problem is not listed.
required: true
id: required-checks
type: checkboxes
labels: ['rfc']
title: Your Title Here
26 changes: 6 additions & 20 deletions .github/ISSUE_TEMPLATE/01-bug-report-plugin.yaml
@@ -1,9 +1,9 @@
name: "🐛 Report a Bug With a Rule"
description: "Report a bug you encountered with a lint rule"
title: "Bug: [rule name here] <short description of the issue>"
name: '🐛 Report a Bug With a Rule'
description: 'Report a bug you encountered with a lint rule'
title: 'Bug: [rule name here] <short description of the issue>'
labels:
- bug
- "package: eslint-plugin"
- 'package: eslint-plugin'
- triage
body:
- type: checkboxes
Expand All @@ -16,9 +16,9 @@ body:
required: true
- label: I have updated to the latest version of the packages.
required: true
- label: I have [searched for related issues](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aissue+label%3Abug+label%3A%22package%3A+eslint-plugin%22) and found none that matched my issue.
- label: I have [searched for related issues](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aissue+label%3A%22package%3A+eslint-plugin%22) and found none that matched my issue.
required: true
- label: I have [read the FAQ](https://typescript-eslint.io/docs/linting/troubleshooting) and my problem is not listed.
- label: I have [read the FAQ](https://typescript-eslint.io/linting/troubleshooting) and my problem is not listed.
required: true
- type: input
id: playground-link
Expand Down Expand Up @@ -98,17 +98,3 @@ body:
description: |
Any additional info you'd like to provide.
If ESLint threw an exception, please run your lint again with the `--debug` flag, and dump the output below. e.g. `eslint path/to/broken/file.ts --debug`
- type: textarea
id: versions
attributes:
label: Versions
value: |
| package | version |
| -------------------------------------- | ------- |
| `@typescript-eslint/eslint-plugin` | `X.Y.Z` |
| `@typescript-eslint/parser` | `X.Y.Z` |
| `TypeScript` | `X.Y.Z` |
| `ESLint` | `X.Y.Z` |
| `node` | `X.Y.Z` |
validations:
required: true

0 comments on commit 6573aa0

Please sign in to comment.