diff --git a/packages/eslint-plugin-typescript/.editorconfig b/packages/eslint-plugin-typescript/.editorconfig index 2e62126f25a..f275f4b9e98 100644 --- a/packages/eslint-plugin-typescript/.editorconfig +++ b/packages/eslint-plugin-typescript/.editorconfig @@ -6,3 +6,7 @@ indent_size = 4 trim_trailing_whitespace = true end_of_line = lf insert_final_newline = true + +# yarn / npm uses 2 spaces when it dumps the file after a change +[package.json] +indent_size = 2 diff --git a/packages/eslint-plugin-typescript/.gitignore b/packages/eslint-plugin-typescript/.gitignore index b5152f70d9c..6a862121471 100644 --- a/packages/eslint-plugin-typescript/.gitignore +++ b/packages/eslint-plugin-typescript/.gitignore @@ -16,3 +16,4 @@ versions.json yarn.lock /.vscode/* !/.vscode/settings.json +!/.vscode/extensions.json diff --git a/packages/eslint-plugin-typescript/.travis.yml b/packages/eslint-plugin-typescript/.travis.yml index 23fbd8ae497..2c31c730827 100644 --- a/packages/eslint-plugin-typescript/.travis.yml +++ b/packages/eslint-plugin-typescript/.travis.yml @@ -5,3 +5,9 @@ node_js: - "8" - "10" - "11" +install: yarn +script: + - yarn lint + - yarn format-check + - yarn docs:check + - yarn test diff --git a/packages/eslint-plugin-typescript/.vscode/extensions.json b/packages/eslint-plugin-typescript/.vscode/extensions.json new file mode 100644 index 00000000000..4ccda4d2cdd --- /dev/null +++ b/packages/eslint-plugin-typescript/.vscode/extensions.json @@ -0,0 +1,11 @@ +{ + "recommendations": [ + "esbenp.prettier-vscode", + "dbaeumer.vscode-eslint", + "editorconfig.editorconfig" + ], + "unwantedRecommendations": [ + "hookyqr.beautify", + "dbaeumer.jshint" + ] +} diff --git a/packages/eslint-plugin-typescript/.vscode/settings.json b/packages/eslint-plugin-typescript/.vscode/settings.json index afdda1b13b4..93f6e91a100 100644 --- a/packages/eslint-plugin-typescript/.vscode/settings.json +++ b/packages/eslint-plugin-typescript/.vscode/settings.json @@ -1,7 +1,4 @@ { - // Format a file on save. A formatter must be available, the file must not be auto-saved, and editor must not be shutting down. - "editor.formatOnSave": true, - // An array of languages where Emmet abbreviations should not be expanded. "emmet.excludeLanguages": [ "markdown", diff --git a/packages/eslint-plugin-typescript/CONTRIBUTING.md b/packages/eslint-plugin-typescript/CONTRIBUTING.md new file mode 100644 index 00000000000..6a1e803a576 --- /dev/null +++ b/packages/eslint-plugin-typescript/CONTRIBUTING.md @@ -0,0 +1,46 @@ +# Contributing + +## Commenting and Discussing + +***Don't be a douche.*** +Consider the following when commenting: + +- Everyone is a human (except for the bots). +- Everyone is freely providing their time for this project. +- Everyone wants to build the best tool. + +## PR Requirements + +For a PR to be merged, you must pass the following checks: + +- there must be no lint errors - `yarn lint` +- the code must be formatted - `yarn format` +- your documentation must be up to date - `yarn docs-check` +- all tests must pass - `yarn test` + +There is a commit hook which will help you follow this. +Travis will also automatically run these checks when you submit your PR (and will block us merging until you fix it). + +## Adding/Changing a rule + +When adding or changing a rule, you must: + +- Ensure your feature / bug has an issue behind it. + - This just makes it easier for people to find information in future, because PRs aren't included in the default issue search. +- Ensure your changes are covered by tests. + - There's no hard and fast rule for how much testing is required, but try to cover as many bases as you can. +- Ensure your changes are documented in the `docs` folder. We're working to standardise how we document rules, but your docs should: + - describe what the rule does, and why you might enable it. + - (if any) outline the settings; how to configure them and what each one does + - have clear examples of valid and invalid code when using the rule. Bonus points for extra cases showing what each setting does. + +When adding a rule, you must also add a link to the rule in the README.md. + +## Submitting Issues + +- If your issue relates to a rule, start your title with the rule name: + - `[no-unused-vars] False positive when fooing the bar` +- Search for the issue before you ask; we try hard to ensure it's easy to find existing issues. +- Follow the template. + - We've built it to reduce the chance of us going back to ask you for things. + - Don't be lazy and skip parts of it; we'll just ask you for that information anyway, so it'll only delay the process. diff --git a/packages/eslint-plugin-typescript/package.json b/packages/eslint-plugin-typescript/package.json index f8ba0cdc8b8..9f6fb336dd8 100644 --- a/packages/eslint-plugin-typescript/package.json +++ b/packages/eslint-plugin-typescript/package.json @@ -1,57 +1,54 @@ { - "name": "eslint-plugin-typescript", - "version": "0.14.0", - "description": "TypeScript plugin for ESLint", - "keywords": [ - "eslint", - "eslintplugin", - "eslint-plugin" - ], - "repository": "nzakas/eslint-plugin-typescript", - "author": "Nicholas C. Zakas", - "main": "lib/index.js", - "scripts": { - "lint": "eslint lib/ tests/", - "lint:fix": "eslint lib/ tests/ --fix", - "docs": "eslint-docs", - "docs:check": "eslint-docs check", - "format-no-write": "prettier-eslint lib/**/*.js tests/**/*.js --eslint-config-path=.eslintrc --eslint-ignore --prettier-ignore --eslint-path=node_modules/eslint --config=.prettierrc", - "format": "yarn format-no-write --write", - "format-check": "yarn format-no-write --list-different", - "mocha": "mocha tests --recursive --reporter=dot", - "pretest": "npm run lint", - "test": "mocha tests --recursive --reporter=dot", - "posttest": "npm run docs:check", - "precommit": "npm test && lint-staged" - }, - "dependencies": { - "requireindex": "~1.2.0", - "typescript-eslint-parser": "^17.0.1" - }, - "devDependencies": { - "eslint": "^5.9.0", - "eslint-config-eslint": "^5.0.1", - "eslint-config-prettier": "^3.3.0", - "eslint-docs": "^0.1.1", - "eslint-plugin-node": "^6.0.1", - "eslint-plugin-prettier": "^3.0.0", - "husky": "^1.2.0", - "lint-staged": "^8.1.0", - "mocha": "^5.2.0", - "prettier-eslint-cli": "^4.7.1", - "typescript": "~2.9" - }, - "peerDependencies": { - "eslint": ">=4.13.1 < 6" - }, - "lint-staged": { - "*.js": [ - "yarn format", - "git add" - ] - }, - "engines": { - "node": ">=6" - }, - "license": "MIT" + "name": "eslint-plugin-typescript", + "version": "0.14.0", + "description": "TypeScript plugin for ESLint", + "keywords": [ + "eslint", + "eslintplugin", + "eslint-plugin" + ], + "repository": "nzakas/eslint-plugin-typescript", + "author": "Nicholas C. Zakas", + "main": "lib/index.js", + "scripts": { + "lint": "eslint lib/ tests/", + "lint:fix": "eslint lib/ tests/ --fix", + "docs": "eslint-docs", + "docs:check": "eslint-docs check", + "format-no-write": "prettier-eslint lib/**/*.js tests/**/*.js --eslint-config-path=.eslintrc --eslint-ignore --prettier-ignore --eslint-path=node_modules/eslint --config=.prettierrc", + "format": "yarn format-no-write --write", + "format-check": "yarn format-no-write --list-different", + "test": "mocha tests --recursive --reporter=dot", + "precommit": "yarn lint && yarn test && yarn docs:check && lint-staged" + }, + "dependencies": { + "requireindex": "~1.2.0", + "typescript-eslint-parser": "^17.0.1" + }, + "devDependencies": { + "eslint": "^5.9.0", + "eslint-config-eslint": "^5.0.1", + "eslint-config-prettier": "^3.3.0", + "eslint-docs": "^0.1.1", + "eslint-plugin-node": "^6.0.1", + "eslint-plugin-prettier": "^3.0.0", + "husky": "^1.2.0", + "lint-staged": "^8.1.0", + "mocha": "^5.2.0", + "prettier-eslint-cli": "^4.7.1", + "typescript": "~2.9" + }, + "peerDependencies": { + "eslint": ">=4.13.1 < 6" + }, + "lint-staged": { + "*.js": [ + "yarn format", + "git add" + ] + }, + "engines": { + "node": ">=6" + }, + "license": "MIT" }