Skip to content

Commit

Permalink
feat: migrate to typescript-eslint v7
Browse files Browse the repository at this point in the history
  • Loading branch information
coderbyheart committed Feb 19, 2024
1 parent 105750d commit ea69796
Show file tree
Hide file tree
Showing 19 changed files with 1,285 additions and 6,844 deletions.
3 changes: 0 additions & 3 deletions .eslintrc

This file was deleted.

1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "extends": "./" }
13 changes: 9 additions & 4 deletions .github/workflows/semantic-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,30 @@ jobs:

steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: "20.x"

- name: Authenticate with NPM registry
run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc

- name: Keep npm cache around to speed up installs
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}

- name: Install dependencies
run: npm ci --no-audit
- name: Install peer dependencies
run: npm i --no-save eslint typescript

- name: Check source code with eslint
run: npx eslint --fix --ext .js,.ts,.jsx,.tsx --ignore-pattern commitlint.config.js --ignore-path .gitignore ./
run: npx eslint .

- name: Check if source code is properly formatted
run: npx prettier -c ./

- run: npm test

- name: Semantic release
continue-on-error: true
run: npx semantic-release
26 changes: 0 additions & 26 deletions .github/workflows/sync-issue-labels.yaml

This file was deleted.

7 changes: 5 additions & 2 deletions .github/workflows/update-repo-info.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ jobs:
uses: actions/checkout@v4

- name: Sync repository description
run: gh repo edit --description "`cat package.json | jq -r '.description'`"
run:
gh repo edit --description "`cat package.json | jq -r '.description'`"

- name: Sync repository topics
run: cat package.json | jq '.keywords[]' | xargs -I'{}' gh repo edit --add-topic {}
run:
cat package.json | jq '.keywords[]' | xargs -I'{}' gh repo edit
--add-topic {}

- name: Sync homepage
run: gh repo edit --homepage "`cat package.json | jq -r '.homepage'`"
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# This file should only cover artifacts caused by the source code in this
# repository, not those caused by the personal choice of editor and/or
# environment of a developer.
# see ADR 5 in https://github.com/NordicSemiconductor/asset-tracker-cloud-docs/
node_modules/
npm-debug.log
1 change: 0 additions & 1 deletion .prettierignore

This file was deleted.

30 changes: 0 additions & 30 deletions .prettierrc.js

This file was deleted.

13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
# TypeScript ESLint Config [![npm version](https://img.shields.io/npm/v/@nordicsemiconductor/eslint-config-asset-tracker-cloud-typescript.svg)](https://www.npmjs.com/package/@nordicsemiconductor/eslint-config-asset-tracker-cloud-typescript)
# TypeScript ESLint Config [![npm version](https://img.shields.io/npm/v/@bifravst/eslint-config-typescript.svg)](https://www.npmjs.com/package/@bifravst/eslint-config-typescript)

[![GitHub Actions](https://github.com/NordicSemiconductor/asset-tracker-cloud-eslint-config-typescript/workflows/Semantic%20Release/badge.svg)](https://github.com/NordicSemiconductor/asset-tracker-cloud-eslint-config-typescript/actions)
[![GitHub Actions](https://github.com/bifravst/eslint-config-typescript/workflows/Semantic%20Release/badge.svg)](https://github.com/bifravst/eslint-config-typescript/actions)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Renovate](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com)
[![@commitlint/config-conventional](https://img.shields.io/badge/%40commitlint-config--conventional-brightgreen)](https://github.com/conventional-changelog/commitlint/tree/master/@commitlint/config-conventional)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier/)
[![ESLint: TypeScript](https://img.shields.io/badge/ESLint-TypeScript-blue.svg)](https://github.com/typescript-eslint/typescript-eslint)

ESLint configuration (with
[TypeScript support](https://github.com/typescript-eslint/typescript-eslint))
for all nRF Asset Tracker projects.
ESLint configuration (with [TypeScript support](https://typescript-eslint.io/))
for all our projects.

See
[@nordicsemiconductor/asset-tracker-cloud-code-style](https://github.com/NordicSemiconductor/asset-tracker-cloud-code-style-js#readme)
for usage.

## Installation

npm i --save-dev --save-exact @nordicsemiconductor/eslint-config-asset-tracker-cloud-typescript
npm i --save-dev --save-exact @bifravst/eslint-config-typescript

## Usage

echo '{"extends": "@nordicsemiconductor/eslint-config-asset-tracker-cloud-typescript"}' > .eslintrc
echo '{"extends": "@bifravst/eslint-config-typescript"}' > .eslintrc.json
File renamed without changes.
12 changes: 0 additions & 12 deletions adr/004-move-to-nordicsemiconductor-github-organization.md

This file was deleted.

1 change: 1 addition & 0 deletions commitlint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { extends: ["@commitlint/config-conventional"] };
1 change: 0 additions & 1 deletion commitlint.config.js

This file was deleted.

81 changes: 81 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// @ts-check

import eslint from '@eslint/js'
import tseslint from 'typescript-eslint'
import unicorn from 'eslint-plugin-unicorn'
import preferArrow from 'eslint-plugin-prefer-arrow'
import prettier from 'eslint-config-prettier'
import * as importPlugin from 'eslint-plugin-import'

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
{
languageOptions: {
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
prettier,
unicorn.configs['flat/all'],
{ plugins: { 'prefer-arrow': preferArrow, import: importPlugin } },
{
rules: {
'@typescript-eslint/indent': ['off'],
'@typescript-eslint/no-object-literal-type-assertion': ['off'],
'@typescript-eslint/explicit-function-return-type': ['off'],
'@typescript-eslint/await-thenable': ['error'],
'@typescript-eslint/no-extraneous-class': ['error'],
'@typescript-eslint/no-floating-promises': ['error'],
'@typescript-eslint/no-for-in-array': ['error'],
'@typescript-eslint/no-require-imports': ['error'],
'@typescript-eslint/no-this-alias': ['error'],
'@typescript-eslint/no-type-alias': ['off'],
'@typescript-eslint/no-unnecessary-type-assertion': ['error'],
'@typescript-eslint/no-useless-constructor': ['error'],
'@typescript-eslint/prefer-for-of': ['error'],
'@typescript-eslint/prefer-function-type': ['error'],
'@typescript-eslint/prefer-includes': ['error'],
'@typescript-eslint/prefer-readonly': ['error'],
'@typescript-eslint/prefer-regexp-exec': ['error'],
'@typescript-eslint/prefer-string-starts-ends-with': ['error'],
'@typescript-eslint/promise-function-async': ['error'],
'@typescript-eslint/require-array-sort-compare': ['error'],
'@typescript-eslint/restrict-plus-operands': ['error'],
semi: 'off',
'@typescript-eslint/semi': ['off'],
'@typescript-eslint/member-delimiter-style': [
'error',
{
multiline: {
delimiter: 'none',
requireLast: false,
},
singleline: {
delimiter: 'semi',
requireLast: false,
},
},
],
'@typescript-eslint/prefer-interface': ['off'],
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
'@typescript-eslint/no-explicit-any': ['off'],
'no-console': ['off'],
'@typescript-eslint/strict-boolean-expressions': ['error'],
'@typescript-eslint/prefer-nullish-coalescing': ['error'],
'@typescript-eslint/prefer-optional-chain': ['error'],
'@typescript-eslint/explicit-module-boundary-types': ['error'],
'prefer-promise-reject-errors': ['error'],
'unicorn/prefer-string-slice': ['error'],
'@typescript-eslint/switch-exhaustiveness-check': ['error'],
'prefer-arrow/prefer-arrow-functions': ['error'],
'object-shorthand': ['error'],
'import/extensions': ['error', 'always', { ignorePackages: true }],
},
},
{
ignores: ['eslint.config.js'],
},
)
69 changes: 0 additions & 69 deletions index.js

This file was deleted.

Loading

0 comments on commit ea69796

Please sign in to comment.