chinchiheather / tslint-lines-between-class-members

Custom rule for TSLint to enforce blank lines between class methods - achieves a similar thing to lines-between-class-members in ESLint
18 stars 5 forks source link

must have blank line between class methods (lines-between-class-members)' #3

Closed raptoravis closed 6 years ago

raptoravis commented 6 years ago

image

export class Debug {

  public static Log(...args: any[]) {
    console.log(args);
  }

  public static LogError(...args: any[]) {
    console.error(args);
  }

  public static LogWarning(...args: any[]) {
    console.warn(args);
  }
}

this following is my tslint.json

{
  "extends": ["tslint:latest", "tslint-config-prettier"],

  "rulesDirectory": ["node_modules/tslint-lines-between-class-members"],

  "rules": {
    "quotemark": [true, "single"],
    "indent": [true],
    "interface-name": [false],
    "arrow-parens": false,
    "object-literal-sort-keys": false,
    "no-unused-expression": false,
    "max-classes-per-file": false,
    "no-construct": false,
    "no-empty": false,
    "no-console": false,
    "prefer-for-of": false,
    "variable-name": [true, "ban-keywords", "check-format", "allow-leading-underscore"],
    "no-implicit-dependencies": false,
    "lines-between-class-members": true
  }
}
chinchiheather commented 6 years ago

Hi @raptoravis I have tried looking into this problem but can't seem to reproduce it, what are your typescript/tslint versions?

raptoravis commented 6 years ago

thanks, both are the latest, btw, this is my except of package.json

  "dependencies": {
    "@tweenjs/tween.js": "^17.2.0",
    "axios": "^0.18.0",
    "es6-promise": "^4.2.4",
    "vue": "^2.5.2",
    "vue-router": "^3.0.1"
  },
  "devDependencies": {
    "@types/jest": "^22.1.4",
    "@types/node": "^9.4.6",
    "@types/prettier": "^1.10.0",
    "@types/tween.js": "^16.9.0",
    "autoprefixer": "^7.1.2",
    "babel-core": "^6.22.1",
    "babel-helper-vue-jsx-merge-props": "^2.0.3",
    "babel-jest": "^21.0.2",
    "babel-loader": "^7.1.1",
    "babel-plugin-dynamic-import-node": "^1.2.0",
    "babel-plugin-syntax-jsx": "^6.18.0",
    "babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
    "babel-plugin-transform-runtime": "^6.22.0",
    "babel-plugin-transform-vue-jsx": "^3.5.0",
    "babel-polyfill": "^6.26.0",
    "babel-preset-env": "^1.3.2",
    "babel-preset-stage-2": "^6.22.0",
    "babel-register": "^6.22.0",
    "blueimp-tmpl": "^3.11.0",
    "chalk": "^2.0.1",
    "chromedriver": "^2.27.2",
    "copy-webpack-plugin": "^4.0.1",
    "cross-env": "^5.1.3",
    "cross-spawn": "^5.0.1",
    "css-loader": "^0.28.0",
    "dts-gen": "^0.5.7",
    "extract-text-webpack-plugin": "^3.0.0",
    "file-loader": "^1.1.4",
    "friendly-errors-webpack-plugin": "^1.6.1",
    "git-revision-webpack-plugin": "^2.5.1",
    "glob": "^7.1.2",
    "html-webpack-plugin": "^2.30.1",
    "http-server": "^0.11.1",
    "husky": "^0.14.3",
    "jest": "^22.0.4",
    "jest-serializer-vue": "^0.3.0",
    "lint-staged": "^7.0.0",
    "nightwatch": "^0.9.12",
    "node-notifier": "^5.1.2",
    "optimize-css-assets-webpack-plugin": "^3.2.0",
    "ora": "^1.2.0",
    "portfinder": "^1.0.13",
    "postcss-import": "^11.0.0",
    "postcss-loader": "^2.0.8",
    "postcss-url": "^7.2.1",
    "prettier": "^1.11.1",
    "rimraf": "^2.6.2",
    "selenium-server": "^3.0.1",
    "semver": "^5.3.0",
    "shelljs": "^0.7.6",
    "ts-jest": "^22.4.1",
    "ts-loader": "3.5.0",
    "tslint": "^5.9.1",
    "tslint-config-prettier": "^1.9.0",
    "tslint-eslint-rules": "^5.1.0",
    "typedoc": "^0.11.0",
    "typescript": "^2.7.2",
    "uglifyjs-webpack-plugin": "^1.1.1",
    "url-loader": "^0.5.8",
    "vue-jest": "^1.0.2",
    "vue-loader": "^13.3.0",
    "vue-style-loader": "^3.0.1",
    "vue-template-compiler": "^2.5.2",
    "webpack": "^3.6.0",
    "webpack-bundle-analyzer": "^2.9.0",
    "webpack-dev-server": "^2.9.1",
    "webpack-merge": "^4.1.0"
  },
chinchiheather commented 6 years ago

Hi @raptoravis I have made some changes and deployed a new version - 1.0.5 - let me know if this does anything for you

raptoravis commented 6 years ago

thanks for the update!! it fixed the problem above.

but, for example, the picture below, there should been empty lines between the last three lines, right?

image

chinchiheather commented 6 years ago

Hi @raptoravis do you mean an empty line between the variables? Or an empty line just before them (where it looks like a function ends on line 140)?

raptoravis commented 6 years ago

yes