Skip to content
This repository was archived by the owner on Feb 19, 2024. It is now read-only.

Commit 12b9a31

Browse files
committed
feat: migrate to ESM
This also bundles the plugins so that host projects no longer need to install them. BREAKING CHANGE: new config format
1 parent f1e9d3c commit 12b9a31

File tree

8 files changed

+80
-20
lines changed

8 files changed

+80
-20
lines changed

.eslintrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

.eslintrc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"extends": [
3+
"@nordicsemiconductor/eslint-config-asset-tracker-cloud-typescript"
4+
]
5+
}
File renamed without changes.
File renamed without changes.

index.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
module.exports = {
1+
import unusedImports from 'eslint-plugin-unused-imports'
2+
import typescriptEslint from '@typescript-eslint'
3+
import unicorn from 'unicorn'
4+
import prefer from 'prefer-arrow'
5+
import importPlugin from 'import'
6+
import prettierConfig from 'eslint-config-prettier'
7+
8+
export const config = {
29
parser: '@typescript-eslint/parser',
310
parserOptions: {
411
project: './tsconfig.json',
512
},
6-
plugins: ['@typescript-eslint', 'unicorn', 'prefer-arrow', 'import'],
13+
plugins: [typescriptEslint, unicorn, prefer, importPlugin, unusedImports],
714
extends: [
815
'eslint:recommended',
916
'plugin:@typescript-eslint/recommended',
10-
'prettier',
17+
prettierConfig,
1118
],
1219
rules: {
1320
'@typescript-eslint/indent': ['off'],
@@ -60,6 +67,7 @@ module.exports = {
6067
'prefer-arrow/prefer-arrow-functions': ['error'],
6168
'object-shorthand': ['error'],
6269
'import/extensions': ['error', 'always', { ignorePackages: true }],
70+
'unused-imports/no-unused-imports': ['error'],
6371
},
6472
overrides: [
6573
{
@@ -82,3 +90,5 @@ module.exports = {
8290
node: true,
8391
},
8492
}
93+
94+
export default [config]

package-lock.json

Lines changed: 43 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.0.0-development",
44
"description": "ESLint config for all nRF Asset Tracker projects.",
55
"main": "index.js",
6+
"type": "module",
67
"repository": {
78
"type": "git",
89
"url": "git+https://github.com/NordicSemiconductor/asset-tracker-cloud-eslint-config-typescript.git"
@@ -22,7 +23,8 @@
2223
"eslint-config-prettier": "8.8.0",
2324
"eslint-plugin-import": "2.27.5",
2425
"eslint-plugin-prefer-arrow": "1.2.3",
25-
"eslint-plugin-unicorn": "47.0.0"
26+
"eslint-plugin-unicorn": "47.0.0",
27+
"eslint-plugin-unused-imports": "3.0.0"
2628
},
2729
"devDependencies": {
2830
"@nordicsemiconductor/asset-tracker-cloud-code-style": "12.0.51"

tsconfig.json

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
{
22
"compilerOptions": {
3-
"module": "commonjs",
4-
"target": "es2019",
5-
"lib": ["es2019"],
6-
"strict": true,
7-
"declaration": true,
3+
"target": "esnext",
84
"skipLibCheck": true,
9-
"noUnusedParameters": true,
10-
"noUnusedLocals": true,
11-
"noImplicitThis": true,
12-
"noImplicitReturns": true,
13-
"removeComments": true,
14-
"noFallthroughCasesInSwitch": true,
5+
"esModuleInterop": true,
6+
"allowSyntheticDefaultImports": true,
7+
"strict": true,
158
"forceConsistentCasingInFileNames": true,
16-
"noImplicitAny": true
9+
"module": "ES2022",
10+
"moduleResolution": "node",
11+
"resolveJsonModule": true,
12+
"noEmit": true,
13+
"noFallthroughCasesInSwitch": true,
14+
"verbatimModuleSyntax": true,
15+
"allowUnreachableCode": false,
16+
"allowUnusedLabels": false,
17+
"noImplicitOverride": true,
18+
"noImplicitReturns": true,
19+
"noUncheckedIndexedAccess": true,
20+
"noUnusedLocals": true
1721
}
1822
}

0 commit comments

Comments
 (0)