Skip to content

Commit

Permalink
Switch to ESLint Flat Config file and contents
Browse files Browse the repository at this point in the history
  • Loading branch information
karlhorky committed Nov 12, 2023
1 parent 9ebfcfc commit d2c8ddc
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/checks/eslintConfigIsValid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,18 @@ export default async function eslintConfigIsValid() {

try {
eslintConfigMatches =
(await fs.readFile('./.eslintrc.cjs', 'utf-8')).trim() ===
`/** @type {import('@typescript-eslint/utils').TSESLint.Linter.Config} */
const config = {
extends: ['upleveled'],
};
module.exports = config;`;
(await fs.readFile('./eslint.config.js', 'utf-8')).trim() ===
"export { default } from 'eslint-config-upleveled';";
} catch (error) {
throw new Error(
`Error reading your .eslintrc.cjs file - please delete the file if it exists and reinstall the config using the instructions on https://www.npmjs.com/package/eslint-config-upleveled
`Error reading your eslint.config.js file - please delete the file if it exists and reinstall the config using the instructions on https://www.npmjs.com/package/eslint-config-upleveled
`,
);
}

if (!eslintConfigMatches) {
throw new Error(
`Your .eslintrc.cjs file does not match the configuration file template - please delete the file and reinstall the config using the instructions on https://www.npmjs.com/package/eslint-config-upleveled
`Your eslint.config.js file does not match the configuration file template - please delete the file and reinstall the config using the instructions on https://www.npmjs.com/package/eslint-config-upleveled
`,
);
}
Expand Down

0 comments on commit d2c8ddc

Please sign in to comment.