-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for flat config (#198)
* feat: add support for flat config * Create ten-dingos-mate.md * fix * fix * update
- Loading branch information
Showing
17 changed files
with
380 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"eslint-plugin-toml": minor | ||
--- | ||
|
||
feat: add support for flat config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type { ESLint } from "eslint"; | ||
import * as parser from "toml-eslint-parser"; | ||
export default [ | ||
{ | ||
plugins: { | ||
get toml(): ESLint.Plugin { | ||
// eslint-disable-next-line @typescript-eslint/no-require-imports -- ignore | ||
return require("../../index"); | ||
}, | ||
}, | ||
}, | ||
{ | ||
files: ["*.toml", "**/*.toml"], | ||
languageOptions: { | ||
parser, | ||
}, | ||
rules: { | ||
// ESLint core rules known to cause problems with TOML. | ||
"no-irregular-whitespace": "off", | ||
"spaced-comment": "off", | ||
}, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// IMPORTANT! | ||
// This file has been automatically generated, | ||
// in order to update its content execute "npm run update" | ||
import base from "./base"; | ||
export default [ | ||
...base, | ||
{ | ||
rules: { | ||
// eslint-plugin-toml rules | ||
"toml/no-unreadable-number-separator": "error", | ||
"toml/precision-of-fractional-seconds": "error", | ||
"toml/precision-of-integer": "error", | ||
"toml/vue-custom-block/no-parsing-error": "error", | ||
}, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// IMPORTANT! | ||
// This file has been automatically generated, | ||
// in order to update its content execute "npm run update" | ||
import base from "./base"; | ||
export default [ | ||
...base, | ||
{ | ||
rules: { | ||
// eslint-plugin-toml rules | ||
"toml/array-bracket-newline": "error", | ||
"toml/array-bracket-spacing": "error", | ||
"toml/array-element-newline": "error", | ||
"toml/comma-style": "error", | ||
"toml/indent": "error", | ||
"toml/inline-table-curly-spacing": "error", | ||
"toml/key-spacing": "error", | ||
"toml/keys-order": "error", | ||
"toml/no-space-dots": "error", | ||
"toml/no-unreadable-number-separator": "error", | ||
"toml/padding-line-between-pairs": "error", | ||
"toml/padding-line-between-tables": "error", | ||
"toml/precision-of-fractional-seconds": "error", | ||
"toml/precision-of-integer": "error", | ||
"toml/quoted-keys": "error", | ||
"toml/spaced-comment": "error", | ||
"toml/table-bracket-spacing": "error", | ||
"toml/tables-order": "error", | ||
"toml/vue-custom-block/no-parsing-error": "error", | ||
}, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
export type MaxValues = { | ||
"+": string; | ||
"-": string; // Does not include a minus sign. | ||
"0x": string; | ||
"0o": string; | ||
"0b": string; | ||
}; | ||
/** | ||
* Convert the given maxBit to max hex, octal, binary and decimal number strings | ||
* | ||
* *Export for testing. | ||
*/ | ||
export function maxBitToMaxValues(maxBit: number): MaxValues { | ||
const binaryMax: number[] = []; | ||
const minusMax: number[] = [0]; | ||
const plusMax: number[] = [0]; | ||
const hexMax: number[] = [0]; | ||
const octalMax: number[] = [0]; | ||
for (let index = 0; index < maxBit; index++) { | ||
const binaryNum = index === 0 ? 1 : 0; | ||
binaryMax.push(binaryNum); | ||
|
||
processDigits(minusMax, binaryNum, 10); | ||
processDigits(hexMax, binaryNum, 16); | ||
processDigits(octalMax, binaryNum, 8); | ||
if (index > 0) { | ||
processDigits(plusMax, 1, 10); | ||
} | ||
} | ||
return { | ||
"+": plusMax.reverse().join(""), | ||
"-": minusMax.reverse().join(""), | ||
"0x": hexMax | ||
.map((i) => i.toString(16)) | ||
.reverse() | ||
.join("") | ||
.toLowerCase(), | ||
"0o": octalMax.reverse().join(""), | ||
"0b": binaryMax.join(""), | ||
}; | ||
|
||
/** Process digits */ | ||
function processDigits( | ||
digits: number[], | ||
binaryNum: number, | ||
radix: 10 | 16 | 8, | ||
) { | ||
let num = binaryNum; | ||
for (let place = 0; place < digits.length; place++) { | ||
num = digits[place] * 2 + num; | ||
digits[place] = num % radix; | ||
num = Math.floor(num / radix); | ||
} | ||
while (num > 0) { | ||
digits.push(num % radix); | ||
num = Math.floor(num / radix); | ||
} | ||
} | ||
} |
Oops, something went wrong.