- This topic has 1 voice and 0 replies.
-
AuthorPosts
-
Brian FernandesModeratorIf you updated to a recent version of CodeMix (June 2019), and see errors related to indentation like, “space indentation expected (indent)”, or, “tab indentation expected (tab)”, please read on for details on how these can be fixed.
Why is this happening now?
In CodeMix 2019.6.11, we started using indentation settings from Eclipse to indent your code with tabs, or a fixed number of spaces. Prior to this release, indentation settings for CodeMix editors were separate from those of other Eclipse editors. If your Eclipse and CodeMix settings did not match, you will now be indenting your code with tabs instead of spaces, or vice versa, resulting in linting tools picking these up as warnings as you edit your code.
How do I fix it?
There are several ways in which you can fix this problem:
Correct Eclipse Settings
You can go to the Eclipse preferences at (Preferences > General > Editors > Text Editors) and change the editor indentation settings to match those defined in your linting configuration.Change Linting Rules
Alternatively, you can change your linting configuration to match the Eclipse settings. You can do this by editing your tslint.json file (for TypeScript) or eslint.json file (for JavaScript) and adding / modifying the indent rule, or simply turning the indent validation off.The following are examples for tslint.json files:
Expect indentation of 4 spaces:
{ "rules": { "indent": [ true, "spaces", 4 ], } }
Expect indentation of tabs:
{ "rules": { "indent": [ true, "tabs" ], } }
Turn indent linting off:
{ "rules": { "indent": false } }
See: https://palantir.github.io/tslint/rules/indent/ for more details.
Disable TSLint for TypeScript
There are several ways in which you can disable TSLint.
Note: These changes will disable TSLint entirely, not just indentation warnings.1) Delete the tslint.json file in your project
2) Exclude files in this project:
Preferences > CodeMix > Extensions and click on the file icon on the top right of the dialog toolbar.. This opens asettings.json
file, here you need to add the following to settings:"settings: { "tslint.exclude": ["**/${PROJECT_NAME}/**/*.ts"] }
3) Disable the TSLint Extension
Go to Help > CodeMix Extensions and unchecking TSLint from the list of extensions on the right. -
AuthorPosts