-
Notifications
You must be signed in to change notification settings - Fork 80
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
Rule Suggestion: Convert between Tabs and spaces #36
Comments
Would this logic work? For every line, count the number of leading spaces, |
I think so. One consideration could be to also deal with cases where you have one more space than your tabsize, which would result in |
That would work, but it isn't ideal. Users might not consider that the tabsize set in the Linter plugin is independent from the tabsize set in the Obsidian main setting, leading to unnecessary confusion about the use of that rule |
I was thinking about your use case, when you are copying from external sources. It would be nice if the default tabsize was the obsidian tab size though. |
on the discord, found vault.getConfig("tabSize"). |
I have the rule ready, but I am a bit uncertain about the typescript part.
(text: string) => {
let tabsize = vault.getConfig("tabSize"); // <- this the proper syntax?
(...)
},
|
You should test the tabSize syntax in obsidian. If you put the repo in your plugins folder, after you run Yep dedent deals with it, its pretty smart about the indentation. |
okay, I have a working solution ready, but there are two problem. Problem 1: (!) Plugin typescript: @rollup/plugin-typescript TS2304: Cannot find name 'vault'.
src/rules.ts: (654:23)
654 let tabsize = vault.getConfig("tabSize");
~~~~~ I also tried adding Problem 2: So what I did for now, was to simply use > obsidian-sample-plugin@0.12.0 lint
> eslint . --ext .ts --fix
/Users/chrisgrieser/Google Drive/File Hub/obsidian-linter/src/rules.ts
674:13 error Unexpected tab character no-tabs
676:13 error Unexpected tab character no-tabs
✖ 2 problems (2 errors, 0 warnings)
So assume you would have to change some linter configuration before I can commit this rule? |
Well, at least problem #2 I figured out on my own by using inline comments to temporarily disable linting rules. Will be adding a PR shortly. |
First of all, thanks for the plugin! It's one of those little things saving a bit of time every day.
A rule that I would find very useful is the conversion between tabs and spaces. For me personally, this would be incredibly useful because all the notes I imported from earlier apps use spaces, but the various relationship line css snippets need tabs to work.
The text was updated successfully, but these errors were encountered: