Skip to content
This repository was archived by the owner on Oct 12, 2023. It is now read-only.

Add strict null checking **DRAFT** #25

Draft
wants to merge 15 commits into
base: main-forked
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true

[*.{json,md,yml}]
indent_style = space
indent_size = 2

[*.{ts,js}]
indent_style = space
indent_size = 4

[Makefile]
indent_style = tab
8 changes: 5 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ module.exports = {
sourceType: "module",
},
plugins: ["prettier", "@typescript-eslint"],
extends: ["plugin:prettier/recommended"],
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
rules: {
"prettier/prettier": "error",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
},
],
"@typescript-eslint/no-empty-function": "off",
"prettier/prettier": "warn",
"no-console": "warn",
"no-debugger": "warn",
},
}
22 changes: 0 additions & 22 deletions .github/workflows/lint.yml

This file was deleted.

105 changes: 63 additions & 42 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,83 @@
name: Static Checks

on: pull_request
name: Pull request

jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v3
- name: Install Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci
- run: npm run lint-check-only
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v2
- name: Install Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v2
id: npm-cache
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci
- run: npm run test
- uses: actions/checkout@v3
- name: Install Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v3
id: npm-cache
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci
- run: npm run test
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v2
- name: Install Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci
- run: npm run lint
- uses: actions/checkout@v3
- name: Install Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci
- run: npm run lint
docs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v2
- name: Install Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci
- run: npm run build:doc
- run: git diff-files --ignore-all-space --name-only --exit-code
- uses: actions/checkout@v2
- name: Install Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci
- run: npm run build:doc
- run: git diff-files --ignore-all-space --name-only --exit-code
22 changes: 4 additions & 18 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
module.exports = {
printWidth: 80,
semi: false,
trailingComma: "all",
tabWidth: 4,
overrides: [
{
files: ["*.json"],
options: {
tabWidth: 2,
},
},
{
files: "*.md",
options: {
tabWidth: 2,
},
},
],
printWidth: 80,
semi: false,
trailingComma: "all",
editorConfig: true,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defer basic settings to .editorconfig

}
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [next] - TBD

## [4.5.0] - TBD

### Changed

- Enable TypeScript strict null checks.
- Avoid fetching if caller doesn't provide Window dependency.

### Security

- Address security alery: [Inefficient Regular Expression Complexity in moment](https://github.com/cbsinteractive/openinsights/security/dependabot/21)

## [4.4.1] - 2022-07-21

### Security
Expand Down
Loading