Skip to content

Commit

Permalink
Move govuk-frontend ESLint config to @govuk-frontend/eslint-config
Browse files Browse the repository at this point in the history
Moves the `.eslintrc.js` file usit `git mv` to keep the history of the file.
Adding back a `.eslintrc.js` file in the same commit to keep ESLint working
would confuse Git, though. Instead, we can take advantage of the `.cjs` extension,
which will be understood just as well by ESLint, but is a different file from Git's perspective.
  • Loading branch information
romaricpascal committed Nov 15, 2024
1 parent eb350a1 commit b076e6e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions packages/govuk-frontend/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const createConfig = require('@govuk-frontend/eslint-config/govuk-frontend.eslintrc.js')

module.exports = createConfig(__dirname)
1 change: 1 addition & 0 deletions packages/govuk-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"@babel/core": "^7.26.0",
"@babel/preset-env": "^7.26.0",
"@govuk-frontend/config": "*",
"@govuk-frontend/eslint-config": "*",
"@govuk-frontend/helpers": "*",
"@govuk-frontend/lib": "*",
"@govuk-frontend/tasks": "*",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { join } = require('path')

module.exports = {
module.exports = (dirname) => ({
settings: {
node: {
version: '^18.12.0'
Expand All @@ -14,7 +14,7 @@ module.exports = {
parserOptions: {
// Note: Allow ES2015 for import/export syntax
ecmaVersion: '2015',
project: [join(__dirname, 'tsconfig.build.json')]
project: [join(dirname, 'tsconfig.build.json')]
},
plugins: ['@typescript-eslint', 'es-x'],
extends: [
Expand Down Expand Up @@ -95,4 +95,4 @@ module.exports = {
}
}
]
}
})

0 comments on commit b076e6e

Please sign in to comment.