Skip to content

Replace TSlint with ESlint #322

New issue

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

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

Already on GitHub? # to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
35 changes: 35 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"root": true,
"env": {
"node": true,
"browser": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier",
"prettier/@typescript-eslint"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"parser": "babel-eslint",
"project": "./tsconfig.json",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"prettier"
],
"rules": {
"no-console": 0,
"semi": 0,
"template-curly-spacing": [
2,
"always"
],
"@typescript-eslint/no-explicit-any": 0
}
}
11 changes: 4 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@ language: node_js
cache:
directories:
- ~/.npm
notifications:
email: false
node_js:
- '12'
- '10'
- '11'
- '8'
- '6'
script:
- npm run test:prod && npm run build
after_success:
- npm run travis-deploy-once "npm run report-coverage"
- if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then npm run travis-deploy-once "npm run deploy-docs"; fi
- if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then npm run travis-deploy-once "npm run semantic-release"; fi
- npm run report-coverage
- if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then npm run deploy-docs; fi
- if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then npm run semantic-release; fi
branches:
except:
- /^v\d+\.\d+\.\d+$/
193 changes: 103 additions & 90 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,61 +1,76 @@
{
"name": "--libraryname--",
"version": "0.0.0",
"description": "",
"keywords": [],
"main": "dist/--libraryname--.umd.js",
"module": "dist/--libraryname--.es5.js",
"typings": "dist/types/--libraryname--.d.ts",
"files": [
"dist"
],
"author": "--username-- <--usermail-->",
"repository": {
"type": "git",
"url": ""
},
"license": "MIT",
"engines": {
"node": ">=6.0.0"
},
"scripts": {
"lint": "tslint --project tsconfig.json -t codeFrame 'src/**/*.ts' 'test/**/*.ts'",
"prebuild": "rimraf dist",
"build": "tsc --module commonjs && rollup -c rollup.config.ts && typedoc --out docs --target es6 --theme minimal --mode file src",
"start": "rollup -c rollup.config.ts -w",
"test": "jest --coverage",
"test:watch": "jest --coverage --watch",
"test:prod": "npm run lint && npm run test -- --no-cache",
"deploy-docs": "ts-node tools/gh-pages-publish",
"report-coverage": "cat ./coverage/lcov.info | coveralls",
"commit": "git-cz",
"semantic-release": "semantic-release",
"semantic-release-prepare": "ts-node tools/semantic-release-prepare",
"precommit": "lint-staged",
"postinstall": "ts-node tools/init",
"travis-deploy-once": "travis-deploy-once"
},
"lint-staged": {
"{src,test}/**/*.ts": [
"prettier --write",
"git add"
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"config": {
"commitizen": {
"path": "node_modules/cz-conventional-changelog"
}
},
"description": "",
"devDependencies": {
"@babel/core": "^7.8.4",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-object-rest-spread": "^7.8.3",
"@babel/preset-env": "^7.8.4",
"@commitlint/cli": "^8.3.5",
"@commitlint/config-conventional": "^8.3.4",
"@rollup/plugin-commonjs": "^11.0.2",
"@types/babel__core": "^7.1.3",
"@types/eslint": "^6.1.8",
"@types/eslint-plugin-prettier": "^2.2.0",
"@types/jest": "^25.1.2",
"@types/lodash.camelcase": "^4.3.6",
"@types/node": "^13.7.1",
"@types/prettier": "^1.19.0",
"@types/rimraf": "^2.0.3",
"@types/rollup-plugin-json": "^3.0.2",
"@types/semantic-release": "^15.13.1",
"@types/shelljs": "^0.8.6",
"@typescript-eslint/eslint-plugin": "^2.19.2",
"@typescript-eslint/parser": "^2.19.2",
"colors": "^1.4.0",
"commitizen": "^4.0.3",
"coveralls": "^3.0.9",
"cross-env": "^7.0.0",
"cz-conventional-changelog": "^3.1.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-jest": "^23.7.0",
"eslint-plugin-prettier": "^3.1.2",
"husky": "^4.2.3",
"jest": "^25.1.0",
"jest-config": "^25.1.0",
"lint-staged": "^10.0.7",
"lodash.camelcase": "^4.3.0",
"prettier": "^1.19.1",
"prompt": "^1.0.0",
"replace-in-file": "^5.0.2",
"rimraf": "^3.0.2",
"rollup": "^1.31.1",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-sourcemaps": "^0.5.0",
"rollup-plugin-typescript2": "^0.26.0",
"semantic-release": "^17.0.3",
"shelljs": "^0.8.3",
"ts-jest": "^25.2.0",
"ts-node": "^8.6.2",
"typedoc": "^0.16.9",
"typescript": "^3.7.5"
},
"engines": {
"node": ">=6.0.0"
},
"files": [
"dist"
],
"jest": {
"transform": {
".(ts|tsx)": "ts-jest"
},
"testEnvironment": "node",
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js"
"collectCoverageFrom": [
"src/**/*.{js,ts}"
],
"coveragePathIgnorePatterns": [
"/node_modules/",
Expand All @@ -69,53 +84,51 @@
"statements": 95
}
},
"collectCoverageFrom": [
"src/*.{js,ts}"
"moduleFileExtensions": [
"ts",
"tsx",
"js"
],
"testEnvironment": "node",
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
"transform": {
".(ts|tsx)": "ts-jest"
}
},
"keywords": [],
"license": "MIT",
"lint-staged": {
"{src,test}/**/*.ts": [
"prettier --write",
"git add"
]
},
"main": "dist/--libraryname--.umd.js",
"module": "dist/--libraryname--.es5.js",
"name": "--libraryname--",
"prettier": {
"semi": false,
"singleQuote": true
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
"repository": {
"type": "git",
"url": ""
},
"devDependencies": {
"@commitlint/cli": "^7.1.2",
"@commitlint/config-conventional": "^7.1.2",
"@types/jest": "^23.3.2",
"@types/node": "^10.11.0",
"colors": "^1.3.2",
"commitizen": "^3.0.0",
"coveralls": "^3.0.2",
"cross-env": "^5.2.0",
"cz-conventional-changelog": "^2.1.0",
"husky": "^1.0.1",
"jest": "^23.6.0",
"jest-config": "^23.6.0",
"lint-staged": "^8.0.0",
"lodash.camelcase": "^4.3.0",
"prettier": "^1.14.3",
"prompt": "^1.0.0",
"replace-in-file": "^3.4.2",
"rimraf": "^2.6.2",
"rollup": "^0.67.0",
"rollup-plugin-commonjs": "^9.1.8",
"rollup-plugin-json": "^3.1.0",
"rollup-plugin-node-resolve": "^3.4.0",
"rollup-plugin-sourcemaps": "^0.4.2",
"rollup-plugin-typescript2": "^0.18.0",
"semantic-release": "^15.9.16",
"shelljs": "^0.8.3",
"travis-deploy-once": "^5.0.9",
"ts-jest": "^23.10.2",
"ts-node": "^7.0.1",
"tslint": "^5.11.0",
"tslint-config-prettier": "^1.15.0",
"tslint-config-standard": "^8.0.1",
"typedoc": "^0.12.0",
"typescript": "^3.0.3"
}
"scripts": {
"build": "tsc --module commonjs && rollup -c rollup.config.ts && typedoc --out docs --target es6 --theme minimal --mode file src",
"commit": "git-cz",
"deploy-docs": "ts-node tools/gh-pages-publish",
"lint": "eslint --ext .js,.ts {src,test}/* --fix && prettier --write \"{src,test}/**/*.{js,ts}\"",
"prebuild": "rimraf dist",
"precommit": "lint-staged",
"report-coverage": "cat ./coverage/lcov.info | coveralls",
"semantic-release": "semantic-release",
"semantic-release-prepare": "ts-node tools/semantic-release-prepare",
"start": "rollup -c rollup.config.ts -w",
"test": "jest --coverage",
"test:prod": "npm run lint && npm run test -- --no-cache",
"test:watch": "jest --coverage --watch"
},
"typings": "dist/types/--libraryname--.d.ts",
"version": "0.0.0"
}
14 changes: 7 additions & 7 deletions rollup.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import commonjs from '@rollup/plugin-commonjs'
import camelCase from 'lodash.camelcase'
import json from 'rollup-plugin-json'
import resolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs'
import sourceMaps from 'rollup-plugin-sourcemaps'
import camelCase from 'lodash.camelcase'
import typescript from 'rollup-plugin-typescript2'
import json from 'rollup-plugin-json'

const pkg = require('./package.json')

Expand All @@ -13,12 +13,12 @@ export default {
input: `src/${libraryName}.ts`,
output: [
{ file: pkg.main, name: camelCase(libraryName), format: 'umd', sourcemap: true },
{ file: pkg.module, format: 'es', sourcemap: true },
{ file: pkg.module, format: 'es', sourcemap: true }
],
// Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash')
external: [],
watch: {
include: 'src/**',
include: 'src/**'
},
plugins: [
// Allow json resolution
Expand All @@ -33,6 +33,6 @@ export default {
resolve(),

// Resolve source maps to the original source
sourceMaps(),
],
sourceMaps()
]
}
26 changes: 16 additions & 10 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
{
"compilerOptions": {
"moduleResolution": "node",
"target": "es5",
"module":"es2015",
"lib": ["es2015", "es2016", "es2017", "dom"],
"strict": true,
"sourceMap": true,
"declaration": true,
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"declaration": true,
"declarationDir": "dist/types",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"es2015",
"es2016",
"es2017",
"dom"
],
"module": "es2015",
"moduleResolution": "node",
"outDir": "dist/lib",
"sourceMap": true,
"strict": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
]
},
"include": [
"src"
"src",
"test"
]
}
6 changes: 0 additions & 6 deletions tslint.json

This file was deleted.