Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

Commit

Permalink
Add eslint config, remove tslint
Browse files Browse the repository at this point in the history
  • Loading branch information
charrondev committed Jun 13, 2019
1 parent 8a2eaea commit 047ab27
Show file tree
Hide file tree
Showing 9 changed files with 556 additions and 124 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**/node_modules/**
**/bower_components/**
**/*.js
**/*.jsx
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "@vanilla/eslint-config"
}
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
"@vanilla/babel-preset": "*",
"@vanilla/prettier-config": "*",
"@vanilla/tsconfig": "*",
"@vanillaforums/tslint-config": "1.1.9",
"@vanilla/eslint-config": "*",
"autoprefixer": "^9.5.1",
"axios-mock-adapter": "^1.16.0",
"babel-loader": "^8.0.5",
Expand Down Expand Up @@ -153,9 +153,7 @@
"ts-lint": "^4.5.1",
"ts-node": "^8.1.0",
"tsconfig-paths-webpack-plugin": "^3.2.0",
"tslint": "^5.16.0",
"typescript": "3.4.4",
"typescript-tslint-plugin": "^0.3.1",
"webpack": "^4.30.0",
"webpack-bundle-analyzer": "^3.3.2",
"webpack-dev-server": "^3.3.1",
Expand All @@ -181,7 +179,7 @@
"test:debug": "ts-node -P build/tsconfig.json build/scripts/test.ts --mode=testdebug",
"check-types": "tsc -p tsconfig.json --noemit && yarn lint",
"check-types:watch": "tsc-watch -p tsconfig.json --noemit --onSuccess \"yarn lint\"",
"lint": "tslint -c ./tslint.json -e './**/node_modules/**' -e './**/src/**/*.{js,jsx}' -p ./tsconfig.json -t stylish",
"lint": "eslint \"**/*.{ts,tsx}\"",
"storybook": "start-storybook -p 9001 -c build/.storybook",
"bootstrap": "lerna bootstrap"
}
Expand Down
21 changes: 21 additions & 0 deletions packages/vanilla-eslint-config/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Vanilla Forums

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
70 changes: 70 additions & 0 deletions packages/vanilla-eslint-config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/**
* @copyright 2009-2019 Vanilla Forums Inc.
* @license MIT
*/

module.exports = {
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "react", "jsx-a11y"],
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
// "plugin:jsx-a11y/recommended",
"prettier",
"prettier/react",
"prettier/@typescript-eslint",
],
parserOptions: {
project: "./tsconfig.json",
},
settings: {
react: {
version: "detect",
},
},
rules: {
// We have typescript for these.
"no-undef": "off",
"getter-return": "off",
"no-dupe-class-members": "off",

// Typescript specific rules
"@typescript-eslint/ban-types": [
"error",
{
types: {
Object: "Avoid using the `Object` type. Did you mean `object`?",
Function: "Avoid using the `Function` type. Prefer a specific function type, like `() => void`.",
Boolean: "Avoid using the `Boolean` type. Did you mean `boolean`?",
Number: "Avoid using the `Number` type. Did you mean `number`?",
String: "Avoid using the `String` type. Did you mean `string`?",
Symbol: "Avoid using the `Symbol` type. Did you mean `symbol`?",
},
},
],
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/array-type": ["error", "array-simple"],
"@typescript-eslint/interface-name-prefix": ["error", "always"],
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-parameter-properties": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-object-literal-type-assertion": "off",
"@typescript-eslint/no-var-requires": "off",

// These are currently too strict to enable here
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/explicit-function-return-type": "off",

// A11Y
"jsx-a11y/html-has-lang": "off", // https://github.com/evcohen/eslint-plugin-jsx-a11y/issues/565

// I want to be able to turn these on the future.
// but they each have a lot of files to fix and should be their own PR.
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/await-thenable": "off",
"@typescript-eslint/promise-function-async": "off",
},
};
18 changes: 18 additions & 0 deletions packages/vanilla-eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "@vanilla/eslint-config",
"description": "The official Vanilla eslint configuration.",
"version": "3.0.0",
"main": "index.js",
"peerDependencies": {
"eslint": "^5.16.0"
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "^1.9.0",
"@typescript-eslint/parser": "^1.9.0",
"eslint": "^5.16.0",
"eslint-config-prettier": "^4.3.0",
"eslint-plugin-import": "^2.17.3",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-react": "^7.13.0"
}
}
7 changes: 1 addition & 6 deletions packages/vanilla-tsconfig/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
"module": "esnext",
"isolatedModules": false,
"skipLibCheck": true,
"sourceMap": true,
"plugins": [
{
"name": "typescript-tslint-plugin"
}
]
"sourceMap": true
}
}
3 changes: 0 additions & 3 deletions tslint.json

This file was deleted.

Loading

0 comments on commit 047ab27

Please sign in to comment.