unlight / eslint-plugin-tsc Goto Github PK
View Code? Open in Web Editor NEWWraps a TypeScript compiler checks
License: MIT License
Wraps a TypeScript compiler checks
License: MIT License
When following the README to add the package:
Add to plugins section:
tsc
Add rule to rules section, e.g.
"tsc/config": [1, {
configFile: "tsconfig.json"
}]
When running eslint
the tsc does not catch any errors.
However, if I remove this configuration and pass it inline with the command it works:
eslint --fix --plugin tsc --rule 'tsc/config: [2, {configFile: \"tsconfig.json\"}]'
Here is my eslint config:
module.exports = {
"extends": ["prettier", "react-app", "plugin:import/typescript"],
"plugins": ["tsc", "prettier", "react", "react-hooks", "@typescript-eslint"],
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"env": {
"es6": true,
"browser": true,
"node": true,
"jest": true
},
"rules": {
"tsc/config": [1, {
configFile: "tsconfig.json"
}],
"array-callback-return": "off",
"arrow-parens": "off",
"comma-dangle": "off",
"consistent-return": "off",
"eqeqeq": "off",
"function-paren-newline": "off",
"import/extensions": "error",
"import/first": "error",
"import/order": "error",
"import/no-deprecated": "error",
"import/no-duplicates": "error",
"import/no-extraneous-dependencies": "off",
"import/no-named-as-default": "off",
"import/no-unresolved": "error",
"import/prefer-default-export": "off",
"indent": "off", // in conflict with prettier
"jsx-a11y/anchor-is-valid": "off",
"jsx-a11y/no-redundant-roles": "off",
"max-len": 0, // in conflict with prettier
"no-confusing-arrow": "off",
"no-else-return": "error",
"no-nested-ternary": "off",
"no-return-assign": "off",
"no-param-reassign": "off",
"no-undef": "error",
"no-unused-vars": "error",
"no-use-before-define": "error",
"object-curly-newline": "off",
"prefer-const": "error",
"prefer-destructuring": "error",
"prefer-rest-params": "off",
"prettier/prettier": "error",
"react/default-props-match-prop-types": "off",
"react/forbid-prop-types": "off",
"react/jsx-boolean-value": 2,
"react/jsx-filename-extension": "off",
"react/jsx-uses-react": 2,
"react/jsx-uses-vars": 2,
"react/no-array-index-key": 2,
"react/no-unescaped-entities": "off",
"react/no-unused-state": "off",
"react/prefer-stateless-function": "error",
"react/prop-types": "error",
"react/require-default-props": 2,
"react/sort-comp": 2,
"semi": "off",
"react-hooks/rules-of-hooks": "error", // Checks rules of Hooks
"react-hooks/exhaustive-deps": "warn", // Checks effect dependencies
},
overrides: [
{
files: ['**/*.ts', '**/*.tsx'],
rules: {
"react/prop-types": "off",
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'none',
ignoreRestSiblings: true,
},
],
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: { jsx: true },
warnOnUnsupportedTypeScriptVersion: true,
},
},
],
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
},
}
{
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true,
"jest": true
},
"plugins": [
"import",
"html",
"typescript",
"tslint",
"tsc"
],
"parser": "vue-eslint-parser",
"parserOptions": {
"parser": "typescript-eslint-parser",
"ecmaFeatures": {
"jsx": true,
"useJSXTextNode": true,
"classes": true
},
"sourceType": "module"
},
"root": true,
"extends": [
"airbnb-base",
"plugin:prettier/recommended",
"plugin:vue/recommended"
],
"settings": {
"html/indent": "+2",
"import/resolver": {
"node": true,
"eslint-import-resolver-typescript": true,
"webpack": {
"config": {
"resolve": {
"extensions": [
".vue",
".ts",
".js",
".yml"
]
}
}
}
}
},
"rules": {
"max-len": [
"error",
{
"code": 160
}
],
"no-multi-spaces": 2,
"camelcase": 0,
"no-param-reassign": 0,
"no-underscore-dangle": 0,
"no-unused-vars": 0,
"import/no-named-as-default": 0,
"import/no-unresolved": 0,
"prettier/prettier": {
"trailingComma": "all",
"printWidth": 160
},
"comma-dangle": 2,
"vue/html-closing-bracket-newline": [
"error",
{
"singleline": "never",
"multiline": "always"
}
],
"vue/max-attributes-per-line": [
"error",
{
"singleline": 4,
"multiline": {
"max": 1,
"allowFirstLine": false
}
}
],
"vue/require-default-prop": false,
"indent": [
"error",
2
],
"linebreak-style": "error",
"no-multiple-empty-lines": [
"error",
{
"max": 1,
"maxEOF": 0
}
],
"object-curly-newline": [
"error",
{
"multiline": true
}
],
"comma-spacing": [
"error",
{
"before": false,
"after": true
}
],
"no-trailing-spaces": "error",
"no-console": "warn",
"semi": "error",
"quotes": [
"error",
"double"
],
"object-curly-spacing": [
"error",
"always"
],
"space-before-blocks": [
"error",
{
"functions": "always",
"keywords": "always",
"classes": "never"
}
],
"typescript/no-unused-vars": "error",
"require-jsdoc": [
"error",
{
"require": {
"FunctionDeclaration": true,
"MethodDefinition": true,
"ClassDeclaration": true,
"ArrowFunctionExpression": true,
"FunctionExpression": false
}
}
],
"tsc/config": [1, {
"configFile": "tsconfig.json"
}]
}
}
if I move the typescript-eslint-parser
from parserOptions to top level, it works as intended. But then vue file breaks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.