Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New rule: prefer-readonly-type-declaration #259

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
f79921e
build(deps-dev): bump @commitlint/cli from 16.1.0 to 16.2.1
dependabot[bot] Mar 1, 2022
9c609c9
build(deps-dev): bump rollup from 2.67.0 to 2.68.0
dependabot[bot] Mar 1, 2022
2b507f1
build(deps-dev): bump @types/node from 17.0.15 to 17.0.21
dependabot[bot] Mar 1, 2022
a9742c3
build(deps-dev): bump @typescript-eslint/eslint-plugin
dependabot[bot] Mar 1, 2022
466a4b9
build(deps-dev): bump eslint-plugin-sonarjs from 0.11.0 to 0.12.0
dependabot[bot] Mar 1, 2022
4a838e9
build(deps): bump actions/setup-node from 2 to 3
dependabot[bot] Mar 1, 2022
03f6d24
build(deps): bump actions/checkout from 2 to 3
dependabot[bot] Mar 1, 2022
5c02a3b
build(deps): bump amannn/action-semantic-pull-request
dependabot[bot] Mar 1, 2022
94dbb63
build(deps-dev): bump type-fest from 2.11.1 to 2.12.2
dependabot[bot] Apr 1, 2022
ea162e5
build(deps-dev): bump @rebeccastevens/eslint-config from 1.3.0 to 1.3.9
dependabot[bot] Apr 1, 2022
17fab54
build(deps-dev): bump lint-staged from 12.3.3 to 12.3.7
dependabot[bot] Apr 1, 2022
ccd4910
build(deps-dev): bump @typescript-eslint/parser from 5.10.2 to 5.17.0
dependabot[bot] Apr 1, 2022
61b50da
build(deps): bump pascalgn/automerge-action from 0.14.3 to 0.15.2
dependabot[bot] Apr 1, 2022
a8eb99e
build(deps-dev): bump @types/node from 17.0.21 to 17.0.23
dependabot[bot] Apr 1, 2022
4653a9c
style: fix linting issues
RebeccaStevens Apr 6, 2022
800a9d5
build(deps): update deepmerge-ts
RebeccaStevens Apr 6, 2022
be92c12
build: explicity state the release rules
RebeccaStevens Apr 6, 2022
d97ea32
Merge pull request #360 from jonaskello/release-rules
RebeccaStevens Apr 6, 2022
77eaf7b
Merge pull request #359 from jonaskello/deps-update/deepmerge-ts
RebeccaStevens Apr 6, 2022
3a3ea62
chore(release): 4.2.1 [skip ci]
semantic-release-bot Apr 6, 2022
fa09f5e
build(deps-dev): bump @semantic-release/github from 8.0.2 to 8.0.4
dependabot[bot] May 1, 2022
d2c3bdb
build(deps-dev): bump espree from 9.3.0 to 9.3.1
dependabot[bot] May 1, 2022
559b296
build(deps-dev): bump eslint-import-resolver-typescript
dependabot[bot] May 1, 2022
9b8dc6d
build(deps-dev): bump eslint from 8.8.0 to 8.14.0
dependabot[bot] May 1, 2022
69a2aa5
build(deps): bump actions/stale from 4 to 5
dependabot[bot] May 1, 2022
0fa1bb8
build(deps-dev): bump tslib from 2.3.1 to 2.4.0
dependabot[bot] May 1, 2022
1941608
build(deps): bump codecov/codecov-action from 2.1.0 to 3.1.0
dependabot[bot] May 1, 2022
20e52ef
build(deps): bump amannn/action-semantic-pull-request
dependabot[bot] May 1, 2022
a740d96
build(deps): bump fkirc/skip-duplicate-actions from 3.4.1 to 4.0.0
dependabot[bot] May 1, 2022
214b183
build(deps-dev): bump eslint-plugin-eslint-plugin from 4.1.0 to 4.2.0
dependabot[bot] Jun 1, 2022
2614b0f
build(deps-dev): bump ts-node from 10.4.0 to 10.8.0
dependabot[bot] Jun 1, 2022
0dcaa66
build(deps-dev): bump markdownlint-cli from 0.31.0 to 0.31.1
dependabot[bot] Jun 1, 2022
2f7b6b3
build(deps-dev): bump @semantic-release/npm from 9.0.0 to 9.0.1
dependabot[bot] Jun 1, 2022
1899522
build(deps-dev): bump rollup from 2.68.0 to 2.75.5
dependabot[bot] Jun 1, 2022
90a7914
build(deps): bump amannn/action-semantic-pull-request
dependabot[bot] Jun 1, 2022
ea1d5b4
build(deps): bump pascalgn/automerge-action from 0.15.2 to 0.15.3
dependabot[bot] Jun 1, 2022
2c12f80
build(deps-dev): bump @rollup/plugin-commonjs from 21.0.1 to 22.0.1
dependabot[bot] Jul 1, 2022
aad8a1f
build(deps-dev): bump typescript from 4.5.5 to 4.7.4
dependabot[bot] Jul 1, 2022
e66b6c1
build(deps-dev): bump @types/node from 17.0.23 to 18.0.0
dependabot[bot] Jul 1, 2022
552c63f
build(deps-dev): bump ava from 4.0.1 to 4.3.0
dependabot[bot] Jul 1, 2022
5fcd1dd
build(deps-dev): bump @rollup/plugin-node-resolve from 13.1.3 to 13.3.0
dependabot[bot] Jul 1, 2022
854738e
chore: repo updates
RebeccaStevens Jul 21, 2022
5674d33
refactor: refactor the code base and update linting rules
RebeccaStevens Jan 14, 2022
2e4ed77
feat!(prefer-readonly-type-declaration): creation of new rule.
RebeccaStevens Oct 17, 2021
49552aa
feat!(no-method-signature): deprecate rule in favor of prefer-readonl…
RebeccaStevens Aug 28, 2021
2667d4c
chore: update work test
RebeccaStevens Aug 14, 2021
31da650
chore: setup new linting rule
RebeccaStevens Oct 17, 2021
9b8277c
refactor: bring rule inline with other rules
RebeccaStevens Jan 18, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion .cspell.json
Expand Up @@ -28,12 +28,14 @@
"/`[^`]*`/",
"/\\.\\/docs\\/rules\\/[^.]*.md/",
"/TS[^\\s]+/",
"\\(#.+?\\)"
"\\(#.+?\\)",
"/\\/\\/ @ts-.*/"
],
"words": [
"globstar",
"IIFE",
"IIFEs",
"readonlyness",
"ruleset",
"rulesets",
"typeguard",
Expand Down
70 changes: 62 additions & 8 deletions .eslintrc.json
Expand Up @@ -29,7 +29,13 @@
],
"sourceType": "module"
},
"ignorePatterns": ["/build/", "/coverage/", "/lib/", "/**/*.cjs", "/**/*.js"],
"ignorePatterns": [
"/build/",
"/coverage/",
"/lib/",
"/**/*.cjs",
"/**/*.js"
],
"rules": {
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-unnecessary-condition": "off",
Expand All @@ -41,6 +47,7 @@
"@typescript-eslint/prefer-readonly-parameter-types": "warn",
"import/no-relative-parent-imports": "error",
"functional/prefer-readonly-type": "off",
"functional/prefer-readonly-type-declaration": "warn",
"node/no-unsupported-features/es-builtins": "off",
"node/no-unsupported-features/es-syntax": "off",
"promise/prefer-await-to-callbacks": "off",
Expand All @@ -54,26 +61,74 @@
"overrides": [
// Top level files.
{
"files": ["./*"],
"extends": ["plugin:functional/off"]
"files": [
"./*"
],
"extends": [
"plugin:functional/off"
]
},
// Source files.
{
"files": ["./src/**/*"],
"extends": ["plugin:eslint-plugin/recommended"],
"files": [
"./src/**/*"
],
"extends": [
"plugin:eslint-plugin/recommended"
],
"rules": {
"functional/no-expression-statement": "error"
}
},
// Rule util file.
{
"files": [
"./src/util/rule.ts"
],
"rules": {
"@typescript-eslint/prefer-readonly-parameter-types": "warn"
}
},
// Typeguard files.
{
"files": [
"./src/util/typeguard.ts"
],
"rules": {
"jsdoc/require-jsdoc": "off"
}
},
// Test files.
{
"files": ["./src/util/typeguard.ts", "./tests/**/*", "./cz-adapter/**/*"],
"files": [
"./tests/**/*"
],
"rules": {
"jsdoc/require-jsdoc": "off"
}
},
// CZ Adapter files.
{
"files": [
"./src/util/typeguard.ts",
"./tests/**/*",
"./cz-adapter/**/*"
],
"rules": {
"jsdoc/require-jsdoc": "off"
}
},
{
"files": ["**/*.md/**"],
"rules": {
"functional/prefer-readonly-type-declaration": "off"
}
},
// FIXME: This override is defined in the upsteam; it shouldn't need to be redefined here. Why?
{
"files": ["./**/*.md/**"],
"files": [
"./**/*.md/**"
],
"parserOptions": {
"project": null
},
Expand Down Expand Up @@ -136,7 +191,6 @@
"sonarjs/no-unused-collection": "off",
"unicorn/prefer-optional-catch-binding": "off",
"unicorn/prefer-top-level-await": "off",

"dot-notation": "error",
"no-implied-eval": "error",
"require-await": "error"
Expand Down
42 changes: 25 additions & 17 deletions .github/workflows/ci.yml
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- name: Skip Duplicate Actions
id: skip_check
uses: fkirc/skip-duplicate-actions@v3.4.1
uses: fkirc/skip-duplicate-actions@v4.0.0
with:
concurrent_skipping: "same_content"
paths_ignore: '[".vscode/", "**/docs/**", "**/*.md"]'
Expand All @@ -25,15 +25,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup NodeJs
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: "lts/*"

- run: npm install -g yarn
- run: corepack enable

- name: Install Dependencies
run: yarn install --frozen-lockfile --ignore-scripts --ignore-engines
run: yarn install --immutable

- name: Build
run: yarn build

- name: Run Linting Checks
run: yarn lint
Expand All @@ -51,32 +57,35 @@ jobs:
os:
- "ubuntu-latest"
node_version:
- "12"
- "14"
- "16"
- "18"
ts_version:
- "next"
- "latest"
- "3.4.1"
- "4.4.2"
- "JS"
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.ts_version == 'next' }}
env:
REPORT_COVERAGE: ${{ fromJSON('["false", "true"]')[matrix.ts_version == 'latest' && matrix.node_version == '16' && matrix.os != 'ubuntu-latest'] }}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
# Fetch all commits for codecov.
fetch-depth: ${{ fromJSON('[0, 1]')[ env.REPORT_COVERAGE == 'true'] }}

- name: Setup NodeJs for building
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: "16"

- run: npm install -g yarn
- run: corepack enable

- name: Install Dependencies
run: yarn install --frozen-lockfile --ignore-scripts --ignore-engines
run: yarn install --immutable

- name: Build
run: yarn build
Expand All @@ -86,28 +95,27 @@ jobs:
run: yarn compile-tests

- name: Setup NodeJs ${{ matrix.node_version }} for testing
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}

- run: npm install -g yarn
- run: corepack enable

- name: Remove Dev TypeScript
run: yarn remove typescript --ignore-engines
run: yarn remove typescript

- name: Add TypeScript "${{ matrix.ts_version }}"
if: matrix.ts_version != 'JS'
run: yarn add -D typescript@"${{ matrix.ts_version }}" --ignore-engines

- name: Remove incompatible settings for ts 3.4.1
if: matrix.ts_version == '3.4.1'
run: node -e 'const fs = require("fs"); const tsconfig = require("./tsconfig.base.json"); delete tsconfig.compilerOptions.exactOptionalPropertyTypes; fs.writeFileSync("./tsconfig.base.json", JSON.stringify(tsconfig));'
run: yarn add -D typescript@"${{ matrix.ts_version }}"

- name: Run Tests
run: yarn test
env:
USE_COMPILED_TESTS: ${{ env.REPORT_COVERAGE == 'false' }}

- name: Report coverage
uses: codecov/codecov-action@v2.1.0
uses: codecov/codecov-action@v3.1.0
if: env.REPORT_COVERAGE == 'true'
with:
file: coverage/lcov.info
2 changes: 1 addition & 1 deletion .github/workflows/dependabot-automerge.yml
Expand Up @@ -19,7 +19,7 @@ jobs:

- name: "Merge"
if: steps.waitforstatuschecks.outputs.status == 'success'
uses: pascalgn/automerge-action@v0.14.3
uses: pascalgn/automerge-action@v0.15.3
env:
MERGE_LABELS: ":blue_heart:,!Status: On Hold"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/dependabot.yml
@@ -0,0 +1,49 @@
name: "Dependabot"

on:
pull_request_target:

jobs:
fix-lockfile:
runs-on: ubuntu-latest
if: |
github.actor == 'dependabot[bot]' &&
contains(github.event.pull_request.head.ref, 'dependabot/npm_and_yarn/')
env:
YARN_ENABLE_SCRIPTS: false
YARN_ENABLE_IMMUTABLE_INSTALLS: false

steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GH_TOKEN }}
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 2

- run: git lfs pull --include .yarn/

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "lts/*"

- name: Restore cache
uses: actions/cache@v3
with:
path: .yarn/cache
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-

- run: git checkout HEAD~1 yarn.lock

- run: yarn install --mode=skip-build

- run: yarn dedupe

- name: Commit yarn.lock
run: |
git config user.name "dependabot-fix"
git config user.email "dependabot-fix@example.com"
git add yarn.lock
git commit -m '[dependabot skip] Fix yarn.lock'
git push
2 changes: 1 addition & 1 deletion .github/workflows/labels.yml
Expand Up @@ -9,7 +9,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: micnncim/action-label-syncer@v1
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Expand Up @@ -12,6 +12,6 @@ jobs:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v4.1.0
- uses: amannn/action-semantic-pull-request@v4.5.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9 changes: 6 additions & 3 deletions .github/workflows/release.yml
Expand Up @@ -11,18 +11,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false

- name: Setup NodeJs
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: "lts/*"

- run: npm install -g yarn
- run: corepack enable

- name: Install dependencies
run: yarn install --frozen-lockfile --ignore-scripts
run: yarn install --immutable

- name: Build & Verify
run: yarn verify
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Expand Up @@ -8,7 +8,7 @@ jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v4
- uses: actions/stale@v5
with:
days-before-issue-stale: 60
days-before-issue-close: 7
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Expand Up @@ -3,6 +3,13 @@
/coverage/

.nyc_output/

.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
node_modules/

*.log
Expand Down