Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use eslint for linting typescript #4

Merged
merged 2 commits into from
Aug 1, 2019
Merged
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
1 change: 1 addition & 0 deletions . eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lib/**/*.js
36 changes: 36 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint", "jest"],
"extends": [
"plugin:@typescript-eslint/recommended",
"airbnb-typescript/base",
"prettier/@typescript-eslint",
"plugin:prettier/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript"
],
"env": {
"jest/globals": true,
"browser": true
},
"rules": {
"prettier/prettier": 2,
"import/no-default-export": 2,
"interface-over-type-literal": 0,
"import-name": 0,
"object-literal-sort-keys": 0,
"interface-name": 0
},
"overrides": [
{
"files": "src/**/*.test.ts",
"rules": {
"@typescript-eslint/explicit-function-return-type": 0
}
}
]
}
7 changes: 6 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
"editor.formatOnSave": true
"editor.formatOnSave": true,
"[typescript]": {
"editor.formatOnSave": false
},
"eslint.autoFixOnSave": true,
"eslint.validate": [{ "language": "typescript", "autoFix": true }]
}
84 changes: 44 additions & 40 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,46 @@
{
"name": "consent-management-platform",
"version": "1.0.0-alpha.1",
"description": "Library of useful utilities for managing consent state across *.theguardian.com",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
"test": "jest --config jestconfig.json",
"build": "tsc",
"format": "yarn lint --fix",
"lint": "tslint -p tsconfig.json",
"prepare": "yarn build",
"prepublishOnly": "yarn test && yarn lint",
"preversion": "yarn lint",
"version": "yarn format && git add -A src",
"postversion": "git push && git push --tags"
},
"husky": {
"hooks": {
"pre-push": "yarn lint && yarn test"
}
},
"repository": "https://github.com/guardian/consent-management-platform.git",
"homepage": "https://github.com/guardian/consent-management-platform.git",
"author": "George Haberis <george.haberis@guardian.co.uk>",
"license": "Apache-2.0",
"devDependencies": {
"@types/jest": "^24.0.16",
"husky": "^3.0.2",
"jest": "^24.8.0",
"prettier": "^1.18.2",
"ts-jest": "^24.0.2",
"tslint": "^5.18.0",
"tslint-config-airbnb": "^5.11.1",
"tslint-config-prettier": "^1.18.0",
"tslint-plugin-prettier": "^2.0.1",
"typescript": "^3.5.3"
},
"files": [
"lib/**/*"
]
"name": "consent-management-platform",
"version": "1.0.0-alpha.1",
"description": "Library of useful utilities for managing consent state across *.theguardian.com",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
"test": "jest --config jestconfig.json",
"build": "tsc",
"format": "yarn validate --fix",
"validate": "tsc --noEmit && eslint src/**/*.ts",
"prepare": "yarn build",
"prepublishOnly": "yarn test && yarn validate",
"preversion": "yarn validate",
"version": "yarn format && git add -A src",
"postversion": "git push && git push --tags"
},
"husky": {
"hooks": {
"pre-push": "yarn validate && yarn test"
}
},
"repository": "https://github.com/guardian/consent-management-platform.git",
"homepage": "https://github.com/guardian/consent-management-platform.git",
"author": "George Haberis <george.haberis@guardian.co.uk>",
"license": "Apache-2.0",
"devDependencies": {
"@types/jest": "^24.0.16",
"@typescript-eslint/eslint-plugin": "^1.13.0",
"@typescript-eslint/parser": "^1.13.0",
"eslint": "^6.1.0",
"eslint-config-airbnb-typescript": "^4.0.1",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jest": "^22.14.1",
"eslint-plugin-prettier": "^3.1.0",
"husky": "^3.0.2",
"jest": "^24.8.0",
"prettier": "^1.18.2",
"ts-jest": "^24.0.2",
"typescript": "^3.5.3"
},
"files": [
"lib/**/*"
]
}
2 changes: 1 addition & 1 deletion src/cookies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const getCookieValues = (name: string): string[] => {
const nameEq = `${name}=`;
const cookies = document.cookie.split(';');

return cookies.reduce((acc: string[], cookie: string) => {
return cookies.reduce((acc: string[], cookie: string): string[] => {
const cookieTrimmed = cookie.trim();

if (cookieTrimmed.indexOf(nameEq) === 0) {
Expand Down
25 changes: 0 additions & 25 deletions tslint.json

This file was deleted.

Loading