Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: export meta object * Create loud-elephants-attend.md * fix
- Loading branch information
Showing
11 changed files
with
89 additions
and
21 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-yml": minor | ||
--- | ||
|
||
feat: export meta object |
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,5 @@ | ||
// IMPORTANT! | ||
// This file has been automatically generated, | ||
// in order to update its content execute "yarn build:meta" | ||
export const name = "eslint-plugin-yml" as const; | ||
export const version = "1.6.0" as const; |
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 assert from "assert"; | ||
import plugin from "../../src"; | ||
import { version } from "../../package.json"; | ||
const expectedMeta = { | ||
name: "eslint-plugin-yml", | ||
version, | ||
}; | ||
|
||
describe("Test for meta object", () => { | ||
it("A plugin should have a meta object.", () => { | ||
assert.deepStrictEqual(plugin.meta, expectedMeta); | ||
}); | ||
|
||
for (const [name, processor] of Object.entries( | ||
// @ts-expect-error -- missing processors | ||
plugin.processors || {} | ||
)) { | ||
it(`"${name}" processor should have a meta object.`, () => { | ||
// @ts-expect-error -- missing type | ||
assert.deepStrictEqual(processor.meta, expectedMeta); | ||
}); | ||
} | ||
}); |
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,38 @@ | ||
import fs from "fs"; | ||
import path from "path"; | ||
import { ESLint } from "eslint"; | ||
import { name, version } from "../package.json"; | ||
import { getNewVersion } from "./lib/changesets-util"; | ||
|
||
const META_PATH = path.join(__dirname, "../src/meta.ts"); | ||
|
||
void main(); | ||
|
||
/** main */ | ||
async function main() { | ||
if (!fs.existsSync(META_PATH)) { | ||
fs.writeFileSync(META_PATH, "", "utf8"); | ||
} | ||
const eslint = new ESLint({ fix: true }); | ||
const [result] = await eslint.lintText( | ||
`/* | ||
* IMPORTANT! | ||
* This file has been automatically generated, | ||
* in order to update its content execute "npm run update" | ||
*/ | ||
export const name = ${JSON.stringify(name)} as const; | ||
export const version = ${JSON.stringify(await getVersion())} as const; | ||
`, | ||
{ filePath: META_PATH } | ||
); | ||
fs.writeFileSync(META_PATH, result.output!); | ||
} | ||
|
||
/** Get version */ | ||
function getVersion() { | ||
// eslint-disable-next-line no-process-env -- ignore | ||
if (process.env.IN_VERSION_CI_SCRIPT) { | ||
return getNewVersion(); | ||
} | ||
return version; | ||
} |
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 |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
// }, | ||
"esModuleInterop": true, | ||
"outDir": "lib", | ||
"resolveJsonModule": true, | ||
|
||
"skipLibCheck": true | ||
}, | ||
|