Skip to content

Commit

Permalink
convert anything to ts
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-zhang-at-salesforce committed May 7, 2024
1 parent c0b69da commit 5a8f00c
Show file tree
Hide file tree
Showing 9 changed files with 129 additions and 57 deletions.
11 changes: 8 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@
"root": true,
"extends": [
"eslint:recommended",
"plugin:node/recommended"
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/stylistic"
],
"env": {
"jest": true,
"node": true
},
"rules": {
"strict": ["error", "global"]
"strict": ["error", "global"],
"@typescript-eslint/no-extra-non-null-assertion": "off"
},
"ignorePatterns": ["test/**/test.js"]
"parserOptions": {
"ecmaVersion": 2016,
"sourceType": "module"
}
}
5 changes: 2 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/

'use strict';

module.exports = {
export default {
displayName: 'Unit Tests',
setupFilesAfterEnv: ['jest-extended', 'jest-chain'],
preset: 'ts-jest',
Expand All @@ -17,6 +15,7 @@ module.exports = {
'!**/test/lib/rules/shared.ts'
],
moduleFileExtensions: ['ts', 'js', 'json'],

testResultsProcessor: 'jest-sonar-reporter',
testPathIgnorePatterns: ['/node_modules/', '<rootDir>/lib/'],
moduleDirectories: ['node_modules'],
Expand Down
4 changes: 1 addition & 3 deletions lib/configs/base.js → lib/configs/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/

'use strict';

module.exports = {
export default {
plugins: ['@salesforce/lwc-mobile']
};
4 changes: 1 addition & 3 deletions lib/configs/recommended.js → lib/configs/recommended.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/

'use strict';

module.exports = {
export default {
extends: ['./configs/base'],
rules: {
'@salesforce/lwc-mobile/enforce-foo-bar': 'warn'
Expand Down
12 changes: 4 additions & 8 deletions lib/index.js → lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/

'use strict';

const base = require('./configs/base');
const recommended = require('./configs/recommended');

const enforceFooBar = require('./rules/enforce-foo-bar');

module.exports = {
import base from './configs/base';
import recommended from './configs/recommended';
import enforceFooBar from './rules/enforce-foo-bar';
export default {
rules: {
'enforce-foo-bar': enforceFooBar
},
Expand Down
111 changes: 105 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"engines": {
"node": ">=18"
},
"type": "module",
"main": "lib/index.js",
"directories": {
"lib": "lib",
Expand All @@ -62,13 +63,14 @@
"!**/test/"
],
"dependencies": {
"@typescript-eslint/utils": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"eslint": "^8.57.0",
"@typescript-eslint/utils": "^7.8.0",
"eslint-plugin-eslint-plugin": "^6.1.0",
"eslint-plugin-node": "^11.1.0"
"eslint-plugin-node": "^11.1.0",
"eslint": "^8.57.0"
},
"devDependencies": {
"@eslint/js": "^9.2.0",
"@jest/globals": "^29.7.0",
"@typescript-eslint/rule-tester": "^7.8.0",
"jest": "^29.7.0",
Expand All @@ -77,7 +79,9 @@
"jest-junit": "^16.0.0",
"jest-sonar-reporter": "^2.0.0",
"prettier": "^3.0.2",
"ts-jest": "^29.1.2"
"ts-jest": "^29.1.2",
"typescript": "^5.4.5",
"typescript-eslint": "^7.8.0"
},
"peerDependencies": {
"eslint": ">=7"
Expand Down
26 changes: 0 additions & 26 deletions test/lib/rules/shared.js

This file was deleted.

1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"composite": true /* Enable constraints that allow a TypeScript project to be used with project references. */,
"target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
"module": "Node16" /* Specify what module code is generated. */,
"rootDir": "src" /* Specify the root folder within your source files. */,
"moduleResolution": "Node16" /* Specify how TypeScript looks up a file from a given module specifier. */,
"types": [] /* Specify type package names to be included without being referenced in a source file. */,
"outDir": "dist" /* Specify an output folder for all emitted files. */,
Expand Down

0 comments on commit 5a8f00c

Please sign in to comment.