Giter Club home page Giter Club logo

Comments (7)

vladimir-djokic avatar vladimir-djokic commented on August 25, 2024

Do you need any more information to help you identify the issue? Still not behaving as expected with 0.1.2, yet works with 0.0.5.

from typescript-tslint-plugin.

mjbvz avatar mjbvz commented on August 25, 2024

Do you also have jsRules set in your tslint.json? I see this working as expected using the 0.1.2 plugin version

from typescript-tslint-plugin.

vladimir-djokic avatar vladimir-djokic commented on August 25, 2024

I do. My tsconfig.json extends tslint:all and then I switch rules on/off based on my preference. I can cleary see rules from tslint:all (and additional ones I configured) being applied when using 0.0.5, but not with 0.1.2.

Thank you for you time in tracking this. If you need any more info or you can clearly see that there is something wrong with the configuration, don't hesitate to let me know.

{
    "extends": "tslint:all",
    "rules": {
        "arrow-parens": [ true, "ban-single-arg-parens" ],
        "array-type": false,
        "ban-types": {
            "options": [
                [ "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`?" ]
            ]
        },
        "comment-format": false,
        "completed-docs": [
            true,
            {
                "all": { "visibilities": [ "exported" ] }
            }
        ],
        "curly": false,
        "encoding": false,
        "file-name-casing": false,
        "linebreak-style": false,
        "match-default-export-name": false,
        "max-classes-per-file": false,
        "max-line-length": false,
        "member-ordering": [
            true,
            {
                "order": [
                    "public-constructor",
                    "protected-constructor",
                    "private-constructor",

                    "public-static-method",
                    "protected-static-method",
                    "private-static-method",
                    "public-instance-method",
                    "protected-instance-method",
                    "private-instance-method",

                    "public-static-field",
                    "protected-static-field",
                    "private-static-field",
                    "public-instance-field",
                    "protected-instance-field",
                    "private-instance-field"
                ]
            }
        ],
        "newline-before-return": false,
        "newline-per-chained-call": false,
        "no-consecutive-blank-lines": [ true, 3 ],
        "no-implicit-dependencies": [ true, "dev" ],
        "no-import-side-effect": [
            true,
            { "ignore-module": "(\\.[s]?css)$" }
        ],
        "no-magic-numbers": false,
        "no-namespace": false,
        "no-non-null-assertion": false,
        "no-null-keyword": false,
        "no-parameter-properties": false,
        "no-parameter-reassignment": false,
        "no-submodule-imports": false,
        "no-unbound-method": [ true, "ignore-static" ],
        "no-unsafe-any": false,
        "no-unused-variable": false,
        "no-use-before-declare": false,
        "no-var-keyword": true,
        "no-void-expression": [ true, "ignore-arrow-function-shorthand" ],
        "object-literal-sort-keys": false,
        "object-literal-shorthand": false,
        "one-line": [
            true,
            "check-whitespace"
        ],
        "only-arrow-functions": [ true, "allow-declarations", "allow-named-functions" ],
        "ordered-imports": false,
        "prefer-conditional-expression": false,
        "prefer-method-signature": false,
        "prefer-switch": false,
        "promise-function-async": true,
        "strict-boolean-expressions": [
            true,
            "allow-null-union",
            "allow-undefined-union",
            "allow-string",
            "allow-mix"
        ],
        "strict-type-predicates": false,
        "switch-default": false,
        "switch-final-break": [ true, "always" ],
        "trailing-comma": [
            true,
            { "esSpecCompliant": true }
        ],
        "typedef": false
    },
    "jsRules": {
        "curly": false,
        "file-name-casing": false,
        "forin": false,
        "linebreak-style": false,
        "newline-before-return": false,
        "newline-per-chained-call": false,
        "no-consecutive-blank-lines": [ true, 3 ],
        "no-implicit-dependencies": [ true, "dev" ],
        "no-magic-numbers": false,
        "no-null-keyword": false,
        "no-require-imports": false,
        "object-literal-sort-keys": false,
        "object-literal-shorthand": false,
        "one-line": [
            true,
            "check-whitespace"
        ],
        "trailing-comma": [
            true,
            { "esSpecCompliant": true }
        ]
    }
}

from typescript-tslint-plugin.

mjbvz avatar mjbvz commented on August 25, 2024

Here's what I see in a js file with the latest version of the plugin and your config:

screen shot 2018-12-12 at 6 16 05 pm

In VS Code can you please make sure the js files is include in the tsconfig.json project. Open the JS file and run the Go to project configuration command in the command palette. The js file must be part of the tsconfig.json project for the plugin to be enabled. Try setting "allowJs": true in the tsconfig if the js file is not part of the project

from typescript-tslint-plugin.

vladimir-djokic avatar vladimir-djokic commented on August 25, 2024

I'm using webpack so I do not have files included in tsconfig.json:

{
  "compilerOptions": {
    "baseUrl": ".",
    "experimentalDecorators": true,
    "jsx": "react",
    "lib": [ "es2015", "dom" ],
    "module": "es2015",
    "moduleResolution": "node",
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "skipDefaultLibCheck": true,
    "sourceMap": true,
    "strict": true,
    "target": "es5",
    "types": [ "webpack-env" ],
    "plugins": [{
      "name": "typescript-tslint-plugin",
      "jsEnable": true
    }]
  },
  "exclude": [
      "bin",
      "node_modules"
  ]
}

I cannot put "allowJs": true - that would try to override .js files with them-self. With my current config, .js files are not being linted as are on your side:

annotation 2018-12-13 145918

from typescript-tslint-plugin.

mjbvz avatar mjbvz commented on August 25, 2024

The js files need to be part of your tsconfig for the plugin to work with them. One possible project setup for this:

  • Set allowJs: true in you base tsconfig.json
  • Create a tsconfig.build.json that extends the base tsconfig and sets allowJs: false

from typescript-tslint-plugin.

villelahdenvuo avatar villelahdenvuo commented on August 25, 2024

@mjbvz I'm also hitting this issue, but I have allowJs and jsEnable true. 🤔

		"tslint": "5.15.0",
		"typescript": "3.3.3333",
		"typescript-tslint-plugin": "0.3.1",
{
	"compilerOptions": {
		"allowJs": true,
		"checkJs": true,
		"noUnusedLocals": true,
		"esModuleInterop": true,
		"moduleResolution": "node",
		"experimentalDecorators": true,
		"resolveJsonModule": true,
		"target": "esnext",
		"module": "commonjs",
		"inlineSourceMap": true,
		"inlineSources": true,
		"outDir": "dist",
		"lib": [
			"dom",
			"esnext"
		],
		"plugins": [
			{
				"name": "typescript-tslint-plugin",
				"jsEnable": true,
				"suppressWhileTypeErrorsPresent": false
			}
		]
	}
}

Running tslint via the CLI does show js errors as well.

from typescript-tslint-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.