Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
chore(deps): install and configure TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlafroscia committed Jun 28, 2018
1 parent 31ee07a commit 23705b9
Show file tree
Hide file tree
Showing 8 changed files with 400 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Expand Up @@ -4,3 +4,6 @@ node_modules/
# Output
dist/
tmp/

# TypeScript Declarations
types/
12 changes: 12 additions & 0 deletions .eslintrc.js
Expand Up @@ -27,6 +27,18 @@ module.exports = {
'no-console': 'off'
},
overrides: [
// TypeScript files
{
parser: 'typescript-eslint-parser',
files: [
'addon/**/*.ts',
'tests/**/*.ts'
],
rules: {
'no-undef': 'off',
'no-unused-vars': 'off'
}
},
// tests
{
env: {
Expand Down
25 changes: 21 additions & 4 deletions package.json
Expand Up @@ -16,10 +16,12 @@
},
"scripts": {
"build": "ember build",
"lint:js": "eslint --ext js .",
"lint:js": "eslint --ext js --ext ts .",
"start": "ember server",
"test": "ember test",
"test:all": "ember try:each"
"test:all": "ember try:each",
"prepublishOnly": "ember ts:precompile",
"postpublish": "ember ts:clean"
},
"husky": {
"hooks": {
Expand All @@ -28,7 +30,7 @@
}
},
"lint-staged": {
"*.js": [
"*.{js,ts}": [
"eslint --fix",
"git add"
]
Expand All @@ -41,6 +43,13 @@
"@commitlint/cli": "^7.0.0",
"@commitlint/config-conventional": "^7.0.1",
"@commitlint/travis-cli": "^7.0.0",
"@types/ember": "^2.8.28",
"@types/ember-data": "^2.14.17",
"@types/ember-mocha": "^0.12.3",
"@types/ember-test-helpers": "^0.7.1",
"@types/ember-testing-helpers": "^0.0.3",
"@types/mocha": "^5.2.3",
"@types/rsvp": "^4.0.2",
"broccoli-asset-rev": "^2.7.0",
"chai": "^4.1.2",
"debug": "^3.1.0",
Expand All @@ -58,6 +67,7 @@
"ember-cli-sri": "^2.1.0",
"ember-cli-test-loader": "^2.1.0",
"ember-cli-testdouble": "^0.1.3",
"ember-cli-typescript": "^1.3.2",
"ember-cli-uglify": "^2.1.0",
"ember-data": "^3.1.1",
"ember-export-application-global": "2.0.0",
Expand All @@ -80,7 +90,14 @@
"loader.js": "^4.7.0",
"prettier": "^1.13.5",
"testdouble": "^3.8.1",
"testdouble-chai": "^0.5.0"
"testdouble-chai": "^0.5.0",
"typescript": "^2.9.2",
"typescript-eslint-parser": "^16.0.1"
},
"resolutions": {
"@types/ember": "2.8.28",
"@types/mocha": "5.2.3",
"@types/rsvp": "4.0.2"
},
"engines": {
"node": "^4.5 || 6.* || >= 7.*"
Expand Down
16 changes: 16 additions & 0 deletions tests/dummy/app/config/environment.d.ts
@@ -0,0 +1,16 @@
export default config;

/**
* Type declarations for
* import config from './config/environment'
*
* For now these need to be managed by the developer
* since different ember addons can materialize new entries.
*/
declare const config: {
environment: any;
modulePrefix: string;
podModulePrefix: string;
locationType: string;
rootURL: string;
};
47 changes: 47 additions & 0 deletions tsconfig.json
@@ -0,0 +1,47 @@
{
"compilerOptions": {
"target": "es2017",
"allowJs": true,
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"noImplicitAny": true,
"noImplicitThis": true,
"alwaysStrict": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noEmitOnError": false,
"noEmit": true,
"inlineSourceMap": true,
"inlineSources": true,
"baseUrl": ".",
"module": "es6",
"paths": {
"dummy/tests/*": [
"tests/*"
],
"dummy/*": [
"tests/dummy/app/*",
"app/*"
],
"ember-ajax": [
"addon"
],
"ember-ajax/*": [
"addon/*"
],
"*": [
"types/*"
]
}
},
"include": [
"app",
"addon",
"tests",
"types"
]
}
1 change: 1 addition & 0 deletions types/dummy/index.d.ts
@@ -0,0 +1 @@

8 changes: 8 additions & 0 deletions types/ember-data.d.ts
@@ -0,0 +1,8 @@
/**
* Catch-all for ember-data.
*/
declare module 'ember-data' {
interface ModelRegistry {
[key: string]: any;
}
}

0 comments on commit 23705b9

Please sign in to comment.