-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
not catching no-implicit-any #105
Comments
Could you share your setup? |
Certainly: sublime-text using sublimejsprettier calling prettier-standard {
"auto_format_on_save": true,
"prettier_cli_path": "/tmp/fnm-shell-4267355/bin/prettier-standard"
} .eslintrc.js module.exports = {
root: true,
env: {
es6: true,
node: true,
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2018,
project: './tsconfig.json',
tsconfigRootDir: __dirname,
createDefaultProgram: true,
},
extends: [
'plugin:@typescript-eslint/recommended',
'standard',
'standard-react',
],
plugins: ['@typescript-eslint/eslint-plugin', 'react-hooks'],
rules: {
'react/prop-types': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'@typescript-eslint/no-use-before-define': [
'error',
{
// hoist functions (not variables)
functions: false,
},
],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/member-delimiter-style': [
'error',
{
// no delimiters for interfaces
multiline: {
delimiter: 'none',
requireLast: false,
},
singleline: {
delimiter: 'comma',
requireLast: false,
},
},
],
'@typescript-eslint/indent': 'off',
'no-unused-vars': 'off',
'node/no-unsupported-features/es-syntax': 'off',
'comma-dangle': ['error', 'always-multiline'],
'react/react-in-jsx-scope': 'off',
},
} package.json
tsconfig.json
|
Please remove all eslint, eslint-plugin-, and eslint-config from dependencies (prettier-standard includes them), |
Also currently prettier-standard requires eslint 6.x |
But then when I try and run |
Prettier-standard has built-in linting with --lint flag
…On Wed, 8 Jul 2020 at 04:24, Jordan ***@***.***> wrote:
But then when I try and run yarn eslint . for instance I cannot do so as
it's missing the config and plugins.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#105 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACHMDJ6EORPF4B6XMNWPRTR2PKHJANCNFSM4OS4EGSQ>
.
|
Oh right... I read the README and I still didn't absorb that.. whoops. I shall try again later, however one more thing: I think when I was trying this it didn't pick up on actual linting errors I had configured relating to eslint, for instance no-implicit-any. I can see my LSP in Sublime Text complaining and if I try and build the project it complains but it passed prettier-standard. |
In your configuration I see only |
@sheerun right I've reduced a lot of the stuff from my configs and I will re-paste them here, I am still getting the same problem. Here are example logs first: here I run `yarn build` which executes `next build` as this is for next.js
The build correctly fails, there is no type for the prop here I run `prettier-standard --lint` for all files in my repo, and it passes where it should fail
This should be failing with the same error above and I do not know why it isn't. It is executed via LeftHook pre-commit manually using
Configs: .eslintrc.jsmodule.exports = {
root: true,
env: {
es6: true,
node: true,
browser: true,
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2018,
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
extends: ['plugin:@typescript-eslint/recommended'],
plugins: ['@typescript-eslint/eslint-plugin'],
rules: {
// 'react/prop-types': 'off',
// 'react-hooks/rules-of-hooks': 'error',
// 'react-hooks/exhaustive-deps': 'warn',
// '@typescript-eslint/no-use-before-define': [
// 'error',
// {
// // hoist functions (not variables)
// functions: false,
// },
// ],
// '@typescript-eslint/no-explicit-any': 'off',
// '@typescript-eslint/explicit-function-return-type': 'off',
// '@typescript-eslint/interface-name-prefix': 'off',
// '@typescript-eslint/member-delimiter-style': [
// 'error',
// {
// // no delimiters for interfaces
// multiline: {
// delimiter: 'none',
// requireLast: false,
// },
// singleline: {
// delimiter: 'comma',
// requireLast: false,
// },
// },
// ],
// '@typescript-eslint/indent': 'off',
// 'no-unused-vars': 'off',
// 'node/no-unsupported-features/es-syntax': 'off',
// 'comma-dangle': ['error', 'always-multiline'],
// 'react/react-in-jsx-scope': 'off',
},
} tsconfig.json{
"compilerOptions": {
"rootDir": ".",
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
},
"target": "es6",
"module": "esnext",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"noImplicitAny": true,
"jsx": "preserve",
"plugins": [
{
"name": "typescript-eslint-language-service"
},
{
"name": "typescript-styled-plugin"
}
]
},
"exclude": ["node_modules", "**/node_modules/**", ".next", "dist"],
"include": ["next-env.d.ts", ".eslintrc.js", "**/*.ts", "**/*.tsx", "**/*.d.ts"]
} package.json{
"name": "www",
"version": "0.1.0",
"repository": "[email protected]:tsujp/jec.sh-www.git",
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"importSort": {
".ts, .tsx": {
"style": "eslint",
"parser": "typescript"
}
},
"dependencies": {
"next": "9.4.4",
"normalize.css": "^8.0.1",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-is": "^16.8",
"styled-components": "^5.1.1"
},
"devDependencies": {
"@arkweid/lefthook": "^0.7.2",
"@commitlint/cli": "^9.0.1",
"@commitlint/config-conventional": "^9.0.1",
"@now/node": "^1.7.1",
"@types/node": "14.0.18",
"@types/react": "^16.9.41",
"@types/styled-components": "5.1.1",
"@typescript-eslint/eslint-plugin": "^3.6.0",
"@typescript-eslint/parser": "3.6.0",
"babel-plugin-styled-components": "^1.10.7",
"eslint": "6.8.0",
"import-sort-parser-typescript": "^6.0.0",
"import-sort-style-eslint": "^6.0.0",
"prettier-plugin-import-sort": "^0.0.4",
"prettier-standard": "^16.3.0",
"standard-version": "^8.0.0",
"stylelint": "^13.6.1",
"stylelint-config-recommended": "^3.0.0",
"stylelint-config-styled-components": "^0.1.1",
"stylelint-processor-styled-components": "^1.10.0",
"typescript": "^3.9.6",
"typescript-eslint-language-service": "^3.0.0",
"typescript-styled-plugin": "^0.15.0"
}
} .prettierrc.jsmodule.exports = {
trailingComma: 'all',
endOfLine: 'lf',
arrowParens: 'always',
} .babelrc.js/* STYLED COMPONENTS OPTIONS
*
* PURE - really do remove dead-code, tell it there are no side-effects
* DISPLAYNAME - shows the semantic name in React Dev Tools
* FILENAME - prefixes class names with the semantic name
* MINIFY - self explanatory
* TRANSPILETEMPLATELITERALS - also minify template literals
*/
const trueInProd = process.env.NODE_ENV === 'production'
module.exports = {
presets: ['next/babel'],
plugins: [
[
'styled-components',
{
ssr: true,
pure: trueInProd,
displayName: !trueInProd,
fileName: !trueInProd,
minify: trueInProd,
transpileTemplateLiterals: trueInProd,
},
],
],
} |
This is likely due to this repo being for Javascript and not TypeScript isn't it? I also saw in the sources you're using |
These are only defaults, you override them with |
Also you still have eslint in package.json Prettier-standard includes it |
Also it seems import-sort-style-eslint imports eslint@^5.0.0 instead of 6.x |
I'll remove that from my package json now both eslint and the import sort style |
If you want did you have somewhere we could chat or do you prefer to keep it in the issue? My thinking is we could hash something out in a chat and post relevant findings back here. |
We can keep it here. It seems you are using both babel and typescript which is mixed codebase which has its own issues. You need to use .eslint.js overrides to support both: typescript-eslint/typescript-eslint#109 (comment) Actually I might do it within prettier-standard itself |
The goal is for an .eslintrc.js as follows right? This does not detect the problem during linting either: module.exports = {
root: true,
env: {
es6: true,
node: true,
browser: true,
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2018,
ecmaFeatures: { jsx: true },
sourceType: 'module',
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
extends: ['plugin:@typescript-eslint/recommended'],
plugins: ['@typescript-eslint/eslint-plugin'],
overrides: [
{
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2018,
ecmaFeatures: { jsx: true },
sourceType: 'module',
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
files: ['**/*.ts', '**/*.tsx'],
settings: { react: { version: 'detect' } },
},
],
rules: {
},
} |
If it helps here's the project (its just a hello world, doing this to get a base config setup which is proving extremely difficult) https://gitlab.com/tsujp/jec.sh-www |
ok I'll check your codebase |
@sheerun I tried to flesh out the overrides but again I see no effect, I made a branch with that config |
Please try |
@sheerun I figured this out, @typescript-eslint does not report typescript compiler errors only errors from it's own engine, by design. Unfortunately (but also sensibly) they do not include a check for no-implicit-any as you can instead just use |
I cannot seem to getimport-sort-style-module
to work with prettier-standard, likely as it uses prettierx under the hood right? Does anyone have any guidance there to prevent conflicts.This became about not catching no-implicit-any
The text was updated successfully, but these errors were encountered: